#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^\s*(?:(?:(?:-?(?:usd|\$)|(?:usd|\$)-)(?:(?:0|[1-9]\d*)?(?:\.\d+)?(?<=\d)))|(?:-?(?:(?:0|[1-9]\d*)?(?:\.\d+)?(?<=\d))(?:usd|\$)))\s*$"
Local $sString = " $456 " & @CRLF & _
" $45.6" & @CRLF & _
" $.5" & @CRLF & _
" $-45" & @CRLF & _
" -$45" & @CRLF & _
" usd-456" & @CRLF & _
" usd46" & @CRLF & _
" usd4.6" & @CRLF & _
" usd.46" & @CRLF & _
" 1$" & @CRLF & _
" 1.5$" & @CRLF & _
" .5$" & @CRLF & _
" -.5$" & @CRLF & _
" 5usd" & @CRLF & _
" 456usd" & @CRLF & _
"------------" & @CRLF & _
" $000" & @CRLF & _
" $." & @CRLF & _
" 00.0$" & @CRLF & _
" 455$abc" & @CRLF & _
" abc$123" & @CRLF & _
" abcuds1" & @CRLF & _
" jhb$5665usdjnjnb" & @CRLF & _
" $usd1555" & @CRLF & _
" usd$768" & @CRLF & _
" $566usd" & @CRLF & _
" $5788usdbjhj "
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