#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?:_T\(\"[^\"]+\"\).*?|L\"[^\"]+\".*?)?(?<!#include )(?<!_T\(|L|\\)\"(.*?)\"(?<!\\\")"
Local $sString = ""This is a MBCS string"; // "This is a MBCS string" match" & @CRLF & _
"_T("This is maybe a unicode string"); // no match" & @CRLF & _
"L"This is a unicode string"; // no match" & @CRLF & _
""These both" + "should match"; // "These both" and "should match" match" & @CRLF & _
""This is a \"quoted\" string"; // "This is a \"quoted\" string" match" & @CRLF & _
"_T("Maybe this") + "is a match"; // "is this" match but instead would match ") + "" & @CRLF & _
"do_something(_T("This doesn't match")) + do_something("but this does match"); // "but this does match" match but isntead it matches ")) + do_something(""
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