#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(((\+44\s?\d{4}|\(?0\d{4}\)?)\s?\d{3}\s?\d{3})|((\+44\s?\d{3}|\(?0\d{3}\)?)\s?\d{3}\s?\d{4})|((\+44\s?\d{2}|\(?0\d{2}\)?)\s?\d{4}\s?\d{4}))(\s?\#(\d{4}|\d{3}))?$"
Local $sString = "+447222555555" & @CRLF & _
"+44 7222 555 555" & @CRLF & _
"(0722) 5555555 #2222" & @CRLF & _
"07222 55555" & @CRLF & _
"(07222) 555555" & @CRLF & _
"(07222) 555555" & @CRLF & _
"" & @CRLF & _
"(+447222)555555" & @CRLF & _
"+44(7222)555555" & @CRLF & _
"(0722) 5555555 #22" & @CRLF & _
"" & @CRLF & _
"+4401612223333" & @CRLF & _
"+44(0)1612223333" & @CRLF & _
"+441612223333" & @CRLF & _
"+44 1612223333" & @CRLF & _
"+44(0)161 2223333" & @CRLF & _
"+44(0)161 222 3333"
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