#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?:\b[\s]?|[^x])([\d]{1}[\d]{2})(?:[^pi]|[\s]?\b)"
Local $sString = "This is (321) an example." & @CRLF & _
"(321) also" & @CRLF & _
"including (321) //basically not possible, but can't hurt." & @CRLF & _
"this (321) has another group with a p: 122p" & @CRLF & _
"this (321) has another group with a I: 123i" & @CRLF & _
"this x235 should be ignored cause (123) is what i want to match." & @CRLF & _
"(123) is what i want, not x111 or 125p or 999i" & @CRLF & _
"in this 111 case there is no solution 555" & @CRLF & _
"101 202.something" & @CRLF & _
""
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