#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(?=.*)((?:\+61) ?(?:\((?=.*\)))?([2-47-8])\)?|(?:\((?=.*\)))?([0-1][2-47-8])\)?) ?-?(?=.*)((\d{1} ?-?\d{3}$)|(00 ?-?\d{4} ?-?\d{4}$)|( ?-?\d{4} ?-?\d{4}$)|(\d{2} ?-?\d{3} ?-?\d{3}$))"
Local $sString = "+61 3 12345678" & @CRLF & _
"+61 3 1234 5678" & @CRLF & _
"+61 3 1234-5678" & @CRLF & _
"+61 (3) 12345678" & @CRLF & _
"+61 (3) 1234 5678" & @CRLF & _
"+61 (3) 1234-5678" & @CRLF & _
"0312345678" & @CRLF & _
"03 1234 5678" & @CRLF & _
"03-1234-5678" & @CRLF & _
"(03)12345678" & @CRLF & _
"(03) 1234 5678" & @CRLF & _
"(03) 1234-5678" & @CRLF & _
"0412345678" & @CRLF & _
"0412 345 678" & @CRLF & _
"0412-345-678" & @CRLF & _
"131234" & @CRLF & _
"131 234" & @CRLF & _
"131-234" & @CRLF & _
"130012345678" & @CRLF & _
"1300 1234 5678" & @CRLF & _
"1300-1234-5678" & @CRLF & _
"180012345678" & @CRLF & _
"" & @CRLF & _
"Fail cases:" & @CRLF & _
"+61 (03) 1234-5678" & @CRLF & _
"+61(0289876544" & @CRLF & _
"(715) 867-5309" & @CRLF & _
"+1 661 2019-835"
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