#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)(<ApplicationPath>.*\\West\\.*<\/ApplicationPath>\n)<CommandLine \/>"
Local $sString = "<ApplicationPath>F:\Objects\Trees\Conifers\North America\West\comporgel.zip</ApplicationPath>" & @CRLF & _
"<CommandLine />" & @CRLF & _
"<ApplicationPath>F:\Objects\Trees\Conifers\North America\West\Christmas.zip</ApplicationPath>" & @CRLF & _
"<Photo />" & @CRLF & _
"<ApplicationPath>F:\Objects\Trees\Conifers\North America\West\spruce1.zip</ApplicationPath>" & @CRLF & _
"<CommandLine />" & @CRLF & _
"<ApplicationPath>F:\Objects\Trees\Conifers\North America\East\spruce1.zip</ApplicationPath>" & @CRLF & _
"<CommandLine />"
Local $sSubst = "$1<CommandLine>trees -nowindow</CommandLine>"
Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst)
MsgBox($MB_SYSTEMMODAL, "Result", $sResult)
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm