#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?xi)# you define first the basic elements (as for a lexer) with named groups" & @CRLF & _
"(?(DEFINE)" & @CRLF & _
"(?<var> [a-z_]\w*)" & @CRLF & _
"" & @CRLF & _
"(?<dqstr> (?<=") [^\\"]*+ (?s:\\.[^\\"]*)*+ (?=") )" & @CRLF & _
"(?<sqstr> (?<=') [^\\']*+ (?s:\\.[^\\']*)*+ (?=') )" & @CRLF & _
"(?<string> \g<dqstr> | \g<sqstr> )" & @CRLF & _
"" & @CRLF & _
"(?<num> [0-9]+(?:\.[0-9]+)? )" & @CRLF & _
"" & @CRLF & _
"(?<value> \g<string> | \g<num> )" & @CRLF & _
"" & @CRLF & _
"(?<comp> [!><=]= | =?[><])" & @CRLF & _
")" & @CRLF & _
"" & @CRLF & _
"# Then you write the pattern using these named groups" & @CRLF & _
"" & @CRLF & _
"(?J) # allow duplicate named groups" & @CRLF & _
"" & @CRLF & _
"# variable op value" & @CRLF & _
"(?<key> \g<var> ) \h* \g<comp> \h* ["']?(?<val> \g<value>) ["']?" & @CRLF & _
"| # OR" & @CRLF & _
"# value op variable" & @CRLF & _
"["']?(?<val> \g<value>) ["']? \h* \g<comp> \h* (?<key> \g<var> )" & @CRLF & _
""
Local $sString = "type == 'prova' && padposition == "stefano" or 10>var_name"
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