#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "\bPAR1234\b|\bPAR\b.*\b1234\b"
Local $sString = "PAR1234" & @CRLF & _
"PAR 1234" & @CRLF & _
"PAR 5678, 1234" & @CRLF & _
"PAR 9991234999, 1234" & @CRLF & _
"PAR !@#-= 1234" & @CRLF & _
"PAR1234-122" & @CRLF & _
"PAR#1234-233" & @CRLF & _
"ANY TEXT PAR#1234-233" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"PART 1234 " & @CRLF & _
"APART 1234 " & @CRLF & _
"PAR 1234999 " & @CRLF & _
"PAR 9991234 " & @CRLF & _
"PAR 9991234999 " & @CRLF & _
"1234 PAR "
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