#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mx)(?<![abc]) # No "a", "b", "c" allowed immediately on the left" & @CRLF & _
"(?=(?:[bc]*a){3}) # At least three "a"s" & @CRLF & _
"(?=(?:[ac]*b){3}) # At least three "b"s" & @CRLF & _
"(?: # Either" & @CRLF & _
" (?=[ab]*(?![abc])) # only "a" or "b"s allowed until a location not followed with "a", "b" or "c"" & @CRLF & _
" | # or" & @CRLF & _
" (?=(?:[ab]*c){3}) # At least three "c"s" & @CRLF & _
")" & @CRLF & _
"[abc]+ # Match and consume one or more "a", "b" or "c" chars"
Local $sString = "Examples for valid sequences:" & @CRLF & _
"" & @CRLF & _
"aaabbb" & @CRLF & _
"ababab" & @CRLF & _
"aaabbbccc" & @CRLF & _
"abcabcabc" & @CRLF & _
"ababcabcc" & @CRLF & _
"" & @CRLF & _
"Examples for invalid sequences (as a whole):" & @CRLF & _
"" & @CRLF & _
"aaabbbc" & @CRLF & _
"aabbb" & @CRLF & _
"abbccc" & @CRLF & _
"abcabca"
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