#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(["])(?:(?!\1|"").|"".)*\1"
Local $sString = "Hello Colm "This is a test""\\"" & @CRLF & _
""This is also an NL test"" & @CRLF & _
"'And this has an escaped quote don\'t in it ' Blue Boy" & @CRLF & _
""This has a single quote ' but doesn\' end the quote as it started with double quotes"" & @CRLF & _
"" & @CRLF & _
""""line spanning with escaped quote at the end of a line"""" & @CRLF & _
"" & @CRLF & _
"""""" & @CRLF & _
"" & @CRLF & _
""Foo Bar" "Another Value" something else"
Local $sSubst = "Subbed"
Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst)
MsgBox($MB_SYSTEMMODAL, "Result", $sResult)
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