#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(?:(?:(\+?972|\(\+?972\)|\+?\(972\))(?:\s|\.|-)?([1-9]\d?))|(0\d{1,2}))(?:\s|\.|-)?([^0\D]{1}\d{2}(?:\s|\.|-)?\d{4})$"
Local $sString = "Valid:" & @CRLF & _
"972 54-333-4444" & @CRLF & _
"+972-54-333-4444" & @CRLF & _
"02-3334444" & @CRLF & _
"02 3334444" & @CRLF & _
"023334444" & @CRLF & _
"050-333-4444" & @CRLF & _
"(+972)54-333-4444" & @CRLF & _
"+(972)50 333 4444" & @CRLF & _
"0753334444" & @CRLF & _
"972543334444" & @CRLF & _
"" & @CRLF & _
"Invalid:" & @CRLF & _
"02-033-4444" & @CRLF & _
"23334444" & @CRLF & _
"02-33-4444" & @CRLF & _
"654-333-4444" & @CRLF & _
"973 54 3334444" & @CRLF & _
"972 054 3334444" & @CRLF & _
"972 02 333 4444"
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