#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?sx)(?(DEFINE)" & @CRLF & _
" (?# var )" & @CRLF & _
" (?<var>[a-zA-Z_\x7f-\xff][\w\x7f-\xff]*)" & @CRLF & _
" (?# val )" & @CRLF & _
" (?<val>(?&call)|(?&str)|(?&num)|(?&bool))" & @CRLF & _
" (?<call>\$\{CALL\s+[a-zA-Z_\x7f-\xff][\w\x7f-\xff]*\s*\})" & @CRLF & _
" (?<str>"[^"]*"|'[^']*')" & @CRLF & _
" (?<num>\d+)" & @CRLF & _
" (?<bool>(?i)(?:false|true)(?-i))" & @CRLF & _
")" & @CRLF & _
"((?(?=no(?8)\S)no|yes))" & @CRLF & _
"(\${(?P<type>VAR)\s+((?&var))\s*\=\s*((?&val))\s*\})(\S)?"
Local $sString = "" & @CRLF & _
"" & @CRLF & _
" ${VAR foo="What"}x" & @CRLF & _
"" & @CRLF & _
" ${VAR foo="What"} " & @CRLF & _
"" & @CRLF & _
" yes${VAR foo="What"}" & @CRLF & _
"" & @CRLF & _
" no${VAR foo="What"}x" & @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