Hi.

Ruby's regular expression is very powerful.

But, I cannot express paired brackets(<...>), which
might be nested, in a single regular expression.

How can I check nested paired brackets by a single/simple
(extended) regular expression, if possible?

eg.
 input            | expected
------------------+--------------
"ab<cd>ef"        | "<cd>"
"ab<cd>e<fg>"     | "<cd>"
"ab<cd<e<>fg>h>i" | "<cd<e<>gh>i>"
"ab<cd<e>f"       | not matched


Y.Saito