#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)\b(?!(\d)\1{3})[13-9]{4}[1346-9][013-9]{5}\b"
Local $sString = "1345678939 all not same; 1st 4 not same, 5th digit not 5, all digits" & @CRLF & _
"3333333333 all are same" & @CRLF & _
"4444151617 1st 4 are same" & @CRLF & _
"3167518888 5th digit = 5" & @CRLF & _
"9876877772 contains a 2" & @CRLF & _
"9876870773 contains a 0 in last 5 digits" & @CRLF & _
"9870677665 contains a 0 in first 5 digits"
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