#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(["'])((?:(?=(?:\\)*)\\.|.)*?)\1"
Local $sString = "" RegExp to match quotes "" & @CRLF & _
"' Supports escapin\' '" & @CRLF & _
"" This is selected \\" this is not" & @CRLF & _
"' Works with JS RegExp '" & @CRLF & _
""You can also get the quote type used"" & @CRLF & _
"" & @CRLF & _
""How it works"" & @CRLF & _
""------------"" & @CRLF & _
"" & @CRLF & _
"' (["\']) Matches a " or a \' and stores it in \1'" & @CRLF & _
"' ( starts \2'" & @CRLF & _
"' (?: starts a non-capturing group'" & @CRLF & _
"' (?=(?:\\)*) Will check if there is an odd amount of \ '" & @CRLF & _
"' \\. will escape / ignore it '" & @CRLF & _
"' |. will never mind it if there\'s an even amount '" & @CRLF & _
"' )*? will close the non-capturing group and repeat it'" & @CRLF & _
"' \1 will make it close with the quote selected in \1'" & @CRLF & _
"" & @CRLF & _
""Flags:"" & @CRLF & _
""------"" & @CRLF & _
"" & @CRLF & _
"" g: global, selects multiple times ""
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