#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "\b(\(?(\+|00)?48\)?)?[ -]?\d{3}[ -]?\d{3}[ -]?\d{3}\b"
Local $sString = "+48 123 456 789 " & @CRLF & _
"" & @CRLF & _
"123456789" & @CRLF & _
"" & @CRLF & _
"123 456 789 " & @CRLF & _
"" & @CRLF & _
"123-456-789" & @CRLF & _
"" & @CRLF & _
"(+48) 123 456 789" & @CRLF & _
"" & @CRLF & _
"+48123456789" & @CRLF & _
"" & @CRLF & _
"0048123456789" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"Things not to capture: " & @CRLF & _
"" & @CRLF & _
"12 345 67 89" & @CRLF & _
"1234567899876543211" & @CRLF & _
"654564654654654654" & @CRLF & _
"spam " & @CRLF & _
"1231312asdasdf1231231" & @CRLF & _
"123321" & @CRLF & _
"+4863227124"
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