If you limit the solution to Perl, as it doesn't provide some builtin that could do that, we go into the land of tricks, as the solution posted by choroba above.
In reply to Re^3: String matching idea
by salva
in thread String matching idea
by baxy77bax
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |