#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?xm)^" & @CRLF & _
"" & @CRLF & _
"# Validate the basic structure" & @CRLF & _
"(?=\d{1,4}\/\d{1,4}\/\d{1,4}$)" & @CRLF & _
"" & @CRLF & _
"# The below subexpression matches a leap year" & @CRLF & _
"# This will be useful later when checking Feb 29th" & @CRLF & _
"(?<leap>0*$|\d*(?:[13579][26]|(?:\b|[02468])[048])(?:00|(?<!00))$){0}" & @CRLF & _
"" & @CRLF & _
"# Match and capture a month, saving a 30-day month or Feb for later reference" & @CRLF & _
"0*(?<month>(?<thirty>9|4|6|11)|(?<feb>2)|1[02]|[13578])\/" & @CRLF & _
"" & @CRLF & _
"# If Feb was matched and 29 appears, check for a leap year" & @CRLF & _
"0*(?<day>[1-9]|1\d|2[0-8]|(?(feb)29(?=\/(?&leap))|(?:29|(?(thirty)30|3[01]))))\/" & @CRLF & _
"" & @CRLF & _
"# Match and capture a year" & @CRLF & _
"(?:0\B)*(?<year>\d+)" & @CRLF & _
"" & @CRLF & _
"$"
Local $sString = "1/25/2018" & @CRLF & _
"3/11/2119" & @CRLF & _
"6/8/224" & @CRLF & _
"6/54/1996" & @CRLF & _
"2/29/2004" & @CRLF & _
"2/29/1900"
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