Perhaps more advantageous would be moritz's suggestion to compile all the patterns into one massive alternation
I didn't suggest that, because I think I once benchmarked it, and seem to recall that at some point it degrades performance (perhaps over the weekend I'll see if I can dig out my benchmark again). I suggested to chose a number, let's say 1000 for a start, and aggregate only that many alternatives into a single regex, and loop over these assembled regexes then.
In reply to Re^2: Efficient regex matching with qr//; Can I do better?
by moritz
in thread Efficient regex matching with qr//; Can I do better?
by kruppy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |