#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)\b(?=[A-Z]{3}\b)A?([B-Z])A?\1A?\b"
Local $sString = "BBA -> true" & @CRLF & _
"ABB -> true" & @CRLF & _
"BAB -> true" & @CRLF & _
"CCA -> true" & @CRLF & _
"AAA -> false (change "[B-Z]" to "[A-Z]" to match this)" & @CRLF & _
"CCB -> false" & @CRLF & _
"ABC -> false" & @CRLF & _
"BAC -> false" & @CRLF & _
"BBBA -> false (there have to be only two)" & @CRLF & _
"ABBB -> false (there have to be only two)" & @CRLF & _
"ABBA -> false (there has to be only one A)" & @CRLF & _
"BABA -> false (there has to be only one A)" & @CRLF & _
"BBAA -> false (there has to be only one A)"
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