$& imposes a needless slowdown on all regexp in your process that aren't already slowed down by captures. Use a capture instead.
Your solution assumes none of the four patterns will match twice.
In reply to Re^2: How to replace greedy alternation?
by ikegami
in thread How to replace greedy alternation?
by adamcrussell
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |