#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^(?:[0-9]{9,15}|(?=[a-zA-Z]*[0-9])(?=[0-9]*[a-zA-Z])[A-Za-z0-9]{6,15})$"
Local $sString = "123456789" & @CRLF & _
"12345678Y" & @CRLF & _
"Y234Y2" & @CRLF & _
"Should not be valid:" & @CRLF & _
"" & @CRLF & _
"12345678" & @CRLF & _
"123X4" & @CRLF & _
"ABCDEFGHYJ" & @CRLF & _
"" & @CRLF & _
" - Contains between 9 and 15 numbers (Only numbers)" & @CRLF & _
" - Contains between 6 and 15 numbers+letters (it must contain both, numbers and letters. Only letters is not a valid option)." & @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