#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)<TEXT>\s*begin \d+ (?>[^e]+|e(?!nd\s*<\/TEXT>))*end\s*<\/TEXT>"
Local $sString = "<HTML>" & @CRLF & _
" <BODY STYLE="font: 10pt Times New Roman, Times, Serif">" & @CRLF & _
"<TEXT>" & @CRLF & _
"begin 644 h52992h5299202.gif" & @CRLF & _
"M1TE&.#EA>P`>`,0``']_?S\_/^_O[P\/#[^_OU]?7Q\?'X^/CY^?GZ^OK\_/" & @CRLF & _
"MSV]O;T]/3]_?WR\O+U!04````/___P``````````````````````````````" & @CRLF & _
"M`````````````````````````"'Y!```````+`````![`!X```7_8"2.9&F>" & @CRLF & _
"M:*JN+"DP22O/=&W?Z`(M>.__0-4`T@@:C\A689=L-0B$!`(!`""@S:P)$M"B" & @CRLF & _
"M!(#"$$(NEP,`0E,AR!X@"N_I`1D$&-6JM,H8PXX-$`5-`@9=<B8(#'$K5$,'" & @CRLF & _
"M1H$0:D@,$#&(*PD`*0(.<$8!@D@*$`:9*P)D*@D0G$&?"$A+KZ@H;PPJ;[4^" & @CRLF & _
"MI09M1Z)%MBB6E"<(ID8&9,!!`G;$7T-?2P[./F]DLD8`$)`F"@0'",->;X<E" & @CRLF & _
"M")\,V#W0`T.\/IX#YA$"8F2BEW)+/",:(!#EX!@0'0!:S>OQ!F"$!&+L%(C#" & @CRLF & _
"MS($<4<#`5#S@SD:#`@#:&#A%P%6W22):_QG@J(`/&7`N`#@`U[+`J0A4`-P[" & @CRLF & _
"M`0V"B`,&!A2`^>.%F5\*@S08*4+!$`,`%HS9$4/``2MAIA:P=(;?O@0=?T*P" & @CRLF & _
"M&&%;DP1>XT%H]P/MO@!3S;P-P$RNF0$+$+3:!X!!7:@=EV`BXQ!)L@()I)*Q" & @CRLF & _
"MPTT&@@(!O)K"<X``5[D.%E2YDN!O90+F7I(8N)C1"&%BQQ:X$@P"L%:11[5`" & @CRLF & _
"M4%=NX8!0")@N`8:MB0*W11#X-("7@W3XELBU$SER8QFETI5<F$(!,Z$<(WB[" & @CRLF & _
"M*2W"1Z(F31#(`[DYLT$T1)F>?AIYB5)<G*D:8+`["?8T"(3M%&U$4A%1I:#-" & @CRLF & _
"M??%09Y]V*/5`VU0*WF`B@@X.KN"4(%!X0]^!*'A37PT*$'6")?(-L9,*$Y8Q" & @CRLF & _
"MP&X8DJ##B$DL04(IZ,U``&0&%+!?BH9D$D4)V:68A"KN^2BD#R4%-^21-O2(" & @CRLF & _
"'Y)(TA```.S\_" & @CRLF & _
"`" & @CRLF & _
"end" & @CRLF & _
"</TEXT>" & @CRLF & _
" <TEXT>losses occurring in the third quarter and from weather </TEXT>" & @CRLF & _
" </BODY>"
Local $sSubst = "<TEXT><\/TEXT>"
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