#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?im)^(?:(?:\(?(?:00|\+)([1-4]\d\d|[1-9]\d?)\)?)?[\-\.\ \\\/]?)?((?:\(?\d{1,}\)?[\-\.\ \\\/]?){0,})(?:[\-\.\ \\\/]?(?:#|ext\.?|extension|x)[\-\.\ \\\/]?(\d+))?$"
Local $sString = "(+351) 282 43 50 50" & @CRLF & _
"90191919908" & @CRLF & _
"555-8909" & @CRLF & _
"001 6867684" & @CRLF & _
"001 6867684x1" & @CRLF & _
"1 (234) 567-8901" & @CRLF & _
"1-234-567-8901 x1234" & @CRLF & _
"1-234-567-8901 ext1234" & @CRLF & _
"1-234 567.89/01 ext.1234" & @CRLF & _
"1(234)5678901x1234" & @CRLF & _
"(123)8575973" & @CRLF & _
"(0055)(123)8575973"
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