RegEx/BalancedBrackets.regex.txt

# Matches content in brackets, as long as it is balanced
\[ # An open bracket
(?> # Followed by...
    [^\[\]]+| # any number of non-bracket character OR
    \[(?<Depth>)| # an open bracket (in which case increment depth) OR
    \](?<-Depth>) # a closed bracket (in which case decrement depth)
)*(?(Depth)(?!)) # until depth is 0.
\] # followed by a closing bracket