#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^0(\d{1,2}(-\d{4}){2}|\d{3}(-\d{3}){2}|\d{2}-\d{3}-\d{4}|\d{3}-\d{2}-\d{4}|\d{4}-\d{1}-\d{4})$"
Local $sString = "090-1111-1111" & @CRLF & _
"03-1111-1111" & @CRLF & _
"0120-111-111" & @CRLF & _
"042-111-1111" & @CRLF & _
"0436-11-1111" & @CRLF & _
"02222-2-2222" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"0333-333-33" & @CRLF & _
"033-333-333" & @CRLF & _
"01-1111-1111" & @CRLF & _
"0-11111-1111" & @CRLF & _
"02-11111-111" & @CRLF & _
"022-123-1231" & @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