#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)\.\K\h*[Jj]ack,? is[^.\n]*\.$"
Local $sString = "Jack is the tallest person." & @CRLF & _
"and Jack is the one who said, let there be fries." & @CRLF & _
"There are mirrors. And Jack is there to be suave." & @CRLF & _
"There are dogs. And jack is there to pat them. Very cool." & @CRLF & _
"Jack is your lumberjack. Jack, is super awesome." & @CRLF & _
"Whereas Jack is, for the whole summer, sound asleep. Zzzz" & @CRLF & _
"'Jack is so cool!' Jack is cool. Jack is also cold."
Local $sSubst = " [TRIM]"
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