#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^DK[0-6]{4}$"
Local $sString = "The regex DK[0-9]{4} specifies that the input must start with "DK" and then be followed by 4 digits from 0 to 6" & @CRLF & _
"" & @CRLF & _
"The following example values are valid:" & @CRLF & _
"DK0001" & @CRLF & _
"DK1323" & @CRLF & _
"DK6666" & @CRLF & _
"" & @CRLF & _
"The following example values are invalid" & @CRLF & _
"DK0007" & @CRLF & _
"DK0009" & @CRLF & _
"DK 3434" & @CRLF & _
"DK232" & @CRLF & _
"DK1" & @CRLF & _
"DK01" & @CRLF & _
"DK001" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"" & @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