#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)\[(b|i|u|h1|h2|h3|large|small|list|table|grid)\](?:((?!\[\/\1\]).)*?|(?R))*\[\/\1\]"
Local $sString = "[b]the problem is that my [i]regex[/i] stops at the [b]first matching closing tag[/b] instead of matching recursively as i [u]expect it to.[/u] [/b]" & @CRLF & _
"[i]regex[/i] stops at the [b]first matching closing tag[/b] instead of matching recursively as i [u]expect it to.[/u]" & @CRLF & _
"" & @CRLF & _
"[a]ssss[a]sssss[/a]ss[/a]" & @CRLF & _
"" & @CRLF & _
"[b]sss[/b]" & @CRLF & _
"" & @CRLF & _
"[c]asdfasd[d]asdaf[/d]fasdf[/c]" & @CRLF & _
"" & @CRLF & _
"[i]test test [i]as fd[/i]this should match the whole line[/i]" & @CRLF & _
"" & @CRLF & _
"[i]test test[j]this should match the whole line[/j]test[/i]" & @CRLF & _
"" & @CRLF & _
"[i] test [j]this should match the pair of 'i' tags and ignore the second 'j' tag [/i] [/j]" & @CRLF & _
"" & @CRLF & _
"the below line should have three sets of matches: center, h3, and grid; it only matches the h3 and grid tags" & @CRLF & _
"[center][logo][/center][hr][hr][h3]header[/h3][/center][hr][hr][grid][row][cell][b]some label[/b][cell]: [date][/grid]" & @CRLF & _
"" & @CRLF & _
""
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