#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)(¶[\S\s]*?¶)"
Local $sString = "This is good text, and should be kept" & @CRLF & _
"" & @CRLF & _
"977" & @CRLF & _
"00:36:46,805 --> 00:36:50,874" & @CRLF & _
"¶ This is complete junk" & @CRLF & _
"And this is also junk, on a second line¶" & @CRLF & _
"" & @CRLF & _
"This is good, and I want to keep it." & @CRLF & _
"" & @CRLF & _
"¶Garbage on its own line¶" & @CRLF & _
"" & @CRLF & _
"This is good" & @CRLF & _
"" & @CRLF & _
"Good sentence ¶but rubbish inline¶ and this is good" & @CRLF & _
"" & @CRLF & _
"Good" & @CRLF & _
"" & @CRLF & _
"¶ Trash" & @CRLF & _
"Rubbish ¶" & @CRLF & _
"" & @CRLF & _
"Good"
Local $sSubst = ""
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