#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?><(?:(?:(?:(script|style|object|embed|applet|noframes|noscript|noembed)(?:\s+(?>"[\S\s]*?"|'[\S\s]*?'|(?:(?!\/>)[^>])?)+)?\s*>)[\S\s]*?<\/\1\s*(?=>))|(?:\/?(?!body)[\w:]+\s*\/?)|(?:(?!body)[\w:]+\s+(?:"[\S\s]*?"|'[\S\s]*?'|[^>]?)+\s*\/?)|\?[\S\s]*?\?|(?:!(?:(?:DOCTYPE[\S\s]*?)|(?:\[CDATA\[[\S\s]*?\]\])|(?:--[\S\s]*?--)|(?:ATTLIST[\S\s]*?)|(?:ENTITY[\S\s]*?)|(?:ELEMENT[\S\s]*?))))>|[\S\s])*?<body(?:\s+(?>"[\S\s]*?"|'[\S\s]*?'|(?:(?!\/>)[^>])?)+)?\s*>((?:<(?:(?:(?:(script|style|object|embed|applet|noframes|noscript|noembed)(?:\s+(?>"[\S\s]*?"|'[\S\s]*?'|(?:(?!\/>)[^>])?)+)?\s*>)[\S\s]*?<\/\3\s*(?=>))|(?:\/?(?!body)[\w:]+\s*\/?)|(?:(?!body)[\w:]+\s+(?:"[\S\s]*?"|'[\S\s]*?'|[^>]?)+\s*\/?)|\?[\S\s]*?\?|(?:!(?:(?:DOCTYPE[\S\s]*?)|(?:\[CDATA\[[\S\s]*?\]\])|(?:--[\S\s]*?--)|(?:ATTLIST[\S\s]*?)|(?:ENTITY[\S\s]*?)|(?:ELEMENT[\S\s]*?))))>|[\S\s])*)<\/body\s*>"
Local $sString = "<html>" & @CRLF & _
" <head>" & @CRLF & _
"" & @CRLF & _
" <meta http-equiv="content-type" content="text/html; charset=utf-8">" & @CRLF & _
" </head>" & @CRLF & _
" <!-- <body class="blah">original mock body </body> -->" & @CRLF & _
" <body text="#000000" bgcolor="#FFFFFF">" & @CRLF & _
"<!CDATA[Raw unparsed character data can contain </body> with no problems!]]>" & @CRLF & _
"<!-- Comments can also contain </body> -->" & @CRLF & _
"So can JScript" & @CRLF & _
"<script>/*<![CDATA[*/window.jQuery && jQuery.ready();/*]]>*/</script><script>if(window.mw){" & @CRLF & _
"mw.loader.state({"ext.glo</body>balCssJs.site":"ready","ext.globalCssJs.user":"ready","site":"loading","user":"ready","user.groups":"ready"});" & @CRLF & _
"}</script>" & @CRLF & _
" <p>dpioaushd iuashdiu ashd</p>" & @CRLF & _
" <p> has</p>" & @CRLF & _
" <p>ud ashuod sh</p>" & @CRLF & _
" <p>odu sad ha</p>" & @CRLF & _
" <p>suod sh</p>" & @CRLF & _
" <p>od uashod uahd<br>" & @CRLF & _
" </p>" & @CRLF & _
" <div class="moz-signature">-- <br>" & @CRLF & _
" <img src="cid:part1.8C289150.C3F89C42@wssim.com.br" border="0"></div>" & @CRLF & _
" </body>" & @CRLF & _
"</html>"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYFULLMATCH)
; Present the entire match result
_ArrayDisplay($aArray, "Result")
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