#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "enum[^{]*{\s*((?!([A-Z][_A-Z0-9]+))\w+)(,\s*(?![_A-Z0-9]+)\w+)*(;[^}]*)*\s*}"
Local $sString = "enum TransparencyState {" & @CRLF & _
" one" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
"enum Blah {" & @CRLF & _
" One" & @CRLF & _
"}" & @CRLF & _
"" & @CRLF & _
"enum TransparencyState {" & @CRLF & _
" gone, TRANSLUCENT, OPAQUE_OR_DULL" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
"enum TransparencyState {" & @CRLF & _
" Gone, " & @CRLF & _
" translucent, " & @CRLF & _
" opaque" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
"enum Blah {" & @CRLF & _
" One, TwO_t" & @CRLF & _
"}" & @CRLF & _
"" & @CRLF & _
"public enum SearchType {" & @CRLF & _
" PARTNO_1," & @CRLF & _
" pART_TYPE;" & @CRLF & _
"" & @CRLF & _
" @Override" & @CRLF & _
" public String toString() {" & @CRLF & _
" return super.toString();" & @CRLF & _
" }" & @CRLF & _
"}"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYFULLMATCH)
; 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