#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?s)((?:<p|\G(?!^))(?:(?!<\/p|<\s*\/?\s*br).)*)<\s*\/?\s*br\s*\/?\s*>"
Local $sString = "These 2 lines should not be<br/>" & @CRLF & _
"touched. Example only.<br/><br/>" & @CRLF & _
"" & @CRLF & _
"<pre class="code">mysql>" & @CRLF & _
"<strong> SELECT state, COUNT(*) FROM president GROUP BY state;</strong><br/>" & @CRLF & _
"+-------+----------+<br/>" & @CRLF & _
"| state | COUNT(*) |<br/>" & @CRLF & _
"+-------+----------+<br/>" & @CRLF & _
"| OH | 7 |<br/>" & @CRLF & _
"| PA | 1 |<br/>" & @CRLF & _
"| SC | 1 |<br/>" & @CRLF & _
"| TX | 2 |<br/>" & @CRLF & _
"| VA | 8 |<br/>" & @CRLF & _
"| VT | 2 |" & @CRLF & _
"+-------+----------+" & @CRLF & _
"sdfsdf<br>" & @CRLF & _
"< /pre>" & @CRLF & _
"sdfsdf<br>" & @CRLF & _
"</pre>" & @CRLF & _
"kshdkjfkjshdf<br>" & @CRLF & _
"<p><br></p>"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH)
Local $aFullArray[0]
For $i = 0 To UBound($aArray) -1
_ArrayConcatenate($aFullArray, $aArray[$i])
Next
$aArray = $aFullArray
; 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