in reply to Re: pattern matching with large regex
in thread pattern matching with large regex

Or instead of handcrafting it, use something like Regex::PreSuf, which groups substrings by longest prefixes (among other things).

If you are using a static set of alternations, I would recommend caching this somehow, though, it is rather expensive time-wise. Additionally, it isn't guaranteed to be faster, so benchmark with reasonable data. (see Re^4: removing stop words for example with benchmark.)

  • Comment on Re^2: pattern matching with large regex