RegEx/PowerShell/Attribute.regex.txt

# Matches a PowerShell attribute declaration
\[
(?<AttributeName>[\w\.]+)
\s{0,}
\( # An open parenthesis
(?<AttributeValue>
(?> # Followed by...
    [^\(\)]+| # any number of non-parenthesis character OR
    \((?<Depth>)| # an open parenthesis (in which case increment depth) OR
    \)(?<-Depth>) # a closed parenthesis (in which case decrement depth)
)*(?(Depth)(?!)) # until depth is 0.
)
\) # followed by a closing parenthesis
\]