#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(THE END|FINIS).*"
Local $sString = "txt <- "... thou hast tam'd a curst shrow. LUCENTIO. 'Tis a wonder, " & @CRLF & _
" by your leave, she will be tam'd so. Exeunt THE END <<THIS ELECTRONIC VERSION OF THE COMPLETE WORKS OF WILLIAM ..."" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"txt <- "... thou hast tam'd a curst shrow. LUCENTIO. 'Tis a wonder, " & @CRLF & _
" by your leave, she will be tam'd so. Exeunt FINIS <<THIS ELECTRONIC VERSION OF THE COMPLETE WORKS OF WILLIAM ...""
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