#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?:(?:\$|\$_|\.(?:find|prependTo|closest))\(\'|(?<!^)\G)\s?([.#][-\w]+)?[^()\s.#]*(?=[^()]*\))"
Local $sString = "/** Get ID */" & @CRLF & _
"$('#aaa').show();" & @CRLF & _
"" & @CRLF & _
"/** Get class */" & @CRLF & _
"$('.bbb').hide();" & @CRLF & _
"" & @CRLF & _
"/** Get IDs and classes and ignore other symbols */" & @CRLF & _
"$('#ccc.ddd > .eee').empty();" & @CRLF & _
"" & @CRLF & _
"/** Ignore other string but catch IDs and Classes*/" & @CRLF & _
"$('div #fff.ggg .hhh').addClass('iii jjj kkk');" & @CRLF & _
"" & @CRLF & _
"/** Test multiple seletor in the same line */" & @CRLF & _
"$('#lll.mmm').$('#nnn.hhh');" & @CRLF & _
"" & @CRLF & _
"/** Weird selector */" & @CRLF & _
"$('#yo-lo-how_are_you');" & @CRLF & _
"" & @CRLF & _
"/** Final test */" & @CRLF & _
"$('#test').removeClass('caris avane aoi').addClass('shirone teameow');"
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