I can only generate the given output when I add the -keep switch to the RE_balanced() call.
What version are you using? From Regexp::Common::balanced:
Since version 2013030901, $1 will always be set (to the entire matched substring), regardless whether {-keep} is used or not.
In reply to Re^3: bracket processing
by haukex
in thread bracket processing
by rajaman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |