#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^[A-Z]+(?:-[A-Z]+)*$"
Local $sString = "PASS :" & @CRLF & _
"NOR" & @CRLF & _
"REGISTER" & @CRLF & _
"FLIP-FLOP" & @CRLF & _
"CPU" & @CRLF & _
"FLIP-FLOP-FLAP" & @CRLF & _
"A" & @CRLF & _
"A-A" & @CRLF & _
"ALL-GOOD" & @CRLF & _
"TIP-US-PLEASE" & @CRLF & _
"OR-IS-THERE-NO-WAY-TO-GET-STUDENT-RECOGNITION-FOR-DOMAINS" & @CRLF & _
"" & @CRLF & _
"FAIL :" & @CRLF & _
"NO-TRAILING-DASH-" & @CRLF & _
"-ACTUALLY-NEITHER-WAY" & @CRLF & _
"NO-DIGIT-TEST1" & @CRLF & _
"2NO-DIGIT-TEST" & @CRLF & _
"N0-DIGIT-T3ST" & @CRLF & _
"NO-SPACE " & @CRLF & _
"NO-SPE_CIAL-CHAR" & @CRLF & _
"SURE?YES"
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