#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(\d{10,21})|(\+\d{1,3}|\d{1,4}|\(\+\d{1,3}\)|\(\d{1,2}\))(([ -.]\d+){1,5}$|([ -.]\d+){1,5}([ -.](ext\.|x|extention))[ -.]\d{1,5}$)"
Local $sString = "Mexico (01) 55 1234 5678" & @CRLF & _
"Mexico (55) 1234 5678" & @CRLF & _
"Germany +49 30 2415889" & @CRLF & _
"UK +44 20 7930 7530" & @CRLF & _
"U.S.A. +1 503-225-5555" & @CRLF & _
"U.S.A. +1 503.225.5555" & @CRLF & _
"U.S.A. +001 503 225 5555" & @CRLF & _
"South Africa +27 21 419 3715" & @CRLF & _
"South Africa (+27) 21 419 3715" & @CRLF & _
"Japan +81 3-3211-3677" & @CRLF & _
"Japan +81 0112716677" & @CRLF & _
"Netherlands +31 20 610 9067" & @CRLF & _
"France +33 1 44 52 71 73" & @CRLF & _
"Australia +61 2 9669 3885" & @CRLF & _
"Australia (06) 1234 1234" & @CRLF & _
"Australia 0444 123 123" & @CRLF & _
"Spain +34 934 12 70 31" & @CRLF & _
"Spain 934 12 70 31" & @CRLF & _
"Portugal +351 21 846 1081" & @CRLF & _
"" & @CRLF & _
"+81 3-3211-3677 ext. 12" & @CRLF & _
"+81 3-3211-3677 x 12" & @CRLF & _
"+81 3-3211-3677 extention 12" & @CRLF & _
"1231231233"
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