I’d like to be able to select, for example, some text, which is between brackets.
Let’s say, we have following text
This is a (sample (or, may be, not)) text, which I write in a browser(with keyboard)
What regex pattern should I use, which would select
(sample (or, may be, not))
and
(with keyboard)
for any number of nested brackets?
One of the known limitations of regex is that regex can’t handle nesting. so for instance
anbn can’t be matched with regex.
Properly parenthesized strings can’t be matched with regex either.
Normally you would some sort of recursive Context-free Grammar implementation