#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^color:(?!\s*@|\s*transparent|\s*inherit).*;$"
Local $sString = "I want to capture all colors that are not "transparent", "inherit" or starts with an "@" character." & @CRLF & _
"" & @CRLF & _
"should be captured" & @CRLF & _
"--------------------------" & @CRLF & _
"color: blue;" & @CRLF & _
"color:red3434;" & @CRLF & _
"color: red3434;" & @CRLF & _
"color: #00FF00;" & @CRLF & _
"color: #F0F;" & @CRLF & _
"color: face(@B23);" & @CRLF & _
"" & @CRLF & _
"should not be captured" & @CRLF & _
"--------------------------" & @CRLF & _
"color: transparent;" & @CRLF & _
"color: @transparent;" & @CRLF & _
"color: @transparent;" & @CRLF & _
"color: inherit;" & @CRLF & _
"color: @B23;"
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