How Regexes Work
perl.plover.com
perl.plover.com
Another fun idea is the opposite of the regex: the regex constructs a state machine of the needle and is then quickly able to run many haystacks through it. Sometimes you need the other optimisation: compile the entire haystack down to a state machine, and you can run many needles through it! It becomes a very primitive search index.
I’m having a hard time understanding how your “haystack compilation” would work. I get the desire to be able to efficiently run many regexes on the same large file, but how could you optimize the file for arbitrary regex matching?
Also discussed only 1 year ago:
https://news.ycombinator.com/item?id=28243636 (174 points, 10 comments)
No thanks
Today, there are numerous excellent tools like this on the web. Back in 2000, it was dark magic and so much fun to work on.