#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)\[(quote)\]?\s*(?:author)?=?(\S+)*"
Local $sString = "[quote author=username link=1150111054/0#7 date=1150151926][/quote]" & @CRLF & _
"" & @CRLF & _
"[quote] username link=1142890417/0#43 date=1156429613]This is a very simple test sentence.[/quote]" & @CRLF & _
"" & @CRLF & _
"[quote=user name pid=123456]" & @CRLF & _
"Test.[/quote]" & @CRLF & _
"" & @CRLF & _
"[quote] user name link=1142890417/0#43 date=1156429613][quote] username link=1142890417/0#43 date=1156429613]This is a very simple test sentence.[/quote]" & @CRLF & _
"This is a very simple test sentence.[/quote]" & @CRLF & _
""
Local $sSubst = "[$1=$2]"
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