#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?i)(([0-9]{1,2}|[a-z]{1,3})-([0-9]{2,3}|[a-z]{2,3})-([0-9]{1,2}|[a-z]{1,2}))"
Local $sString = "XX-99-99" & @CRLF & _
"2 1965 99-99-XX " & @CRLF & _
"3 1973 99-XX-99" & @CRLF & _
"4 1978 XX-99-XX " & @CRLF & _
"5 1991 XX-XX-99 " & @CRLF & _
"6 1999 99-XX-XX " & @CRLF & _
"7 2005 99-XXX-9" & @CRLF & _
"8 2009 9-XXX-99" & @CRLF & _
"9 2006 XX-999-X " & @CRLF & _
"10 2008 X-999-XX " & @CRLF & _
"11 2015 XXX-99-X"
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