As a general proposition, avoiding using unnecessary captures is a Good Thing.
Also as a general proposition, optimisation should be avoided until it becomes obvious that it is unavoidable.
use re 'debug' can tell you a lot about what's going on -- getting a trace of what happens on some real data can be quite instructive. YAPE::Regex::Explain is reputed to be useful, but it does look a little old -- other monks may be able to advise.
One thing that can really slow down regex is back-tracking. The more specific the matching elements, the less opportunity you give for backtracking, the better. Note that a floating start to a regex is an excellent way of triggering a lot of backtracking !
In reply to Re: Speeding up a large regex match pattern
by gone2015
in thread Speeding up a large regex match pattern
by wossname
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |