#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)^(-)?(\d+)(?:[\s\.]0+)?\s*(?:USD)?$"
Local $sString = "123.00 USD" & @CRLF & _
"1234 USD" & @CRLF & _
"357.0 USD" & @CRLF & _
"456 00 USD" & @CRLF & _
"651USD" & @CRLF & _
"753.684 USD" & @CRLF & _
"123 456 USD" & @CRLF & _
"-123 USD" & @CRLF & _
"789.00 XXX" & @CRLF & _
"123.00 wrongcurrency" & @CRLF & _
"test string" & @CRLF & _
"$159" & @CRLF & _
"123"
Local $sSubst = "\0 => \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