OKay, I can see what is driving your requirements. One possibility that might prove a little quicker is Alternative-capture-group-numbering*, which allows you to re-use capture numbering within different match alternatives.
The example given at the reference above is very pertinent to your use. It might at least be worth benchmarking.
*Unfortunately #anchors no longer seem to work at perldoc since they added that annoying moving menu :(
In reply to Re^5: Speeding up named capture buffer access
by BrowserUk
in thread Speeding up named capture buffer access
by SBECK
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |