#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(?:\+44\s?|0)[1238]\d\s?(?:\d\s?){7,8}$"
Local $sString = "# Standard" & @CRLF & _
"01386 444400" & @CRLF & _
"01386444400" & @CRLF & _
"+441386444400" & @CRLF & _
"+44 1386 444400" & @CRLF & _
"+44 1386444400" & @CRLF & _
"" & @CRLF & _
"# 5 Digit" & @CRLF & _
"01386 41204" & @CRLF & _
"0138641204" & @CRLF & _
"+44138641204" & @CRLF & _
"+44 1386 41204" & @CRLF & _
"+44 138641204" & @CRLF & _
"" & @CRLF & _
"# 3 Digit area codes (e.g. London)" & @CRLF & _
"+442074343046" & @CRLF & _
"02074343046" & @CRLF & _
"020 74343046" & @CRLF & _
"020 7434 3046" & @CRLF & _
"" & @CRLF & _
"# 4 Digit area codes (e.g. Leeds)" & @CRLF & _
"+441133971337" & @CRLF & _
"01133971337" & @CRLF & _
"0113 3971337" & @CRLF & _
"" & @CRLF & _
"# Commercial" & @CRLF & _
"08451772266" & @CRLF & _
"0845 1772266" & @CRLF & _
"" & @CRLF & _
"# Mobile number (should not match)" & @CRLF & _
"07999888777" & @CRLF & _
"+447999888777" & @CRLF & _
"07999 888 777" & @CRLF & _
"+44 7999888777" & @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