by EGreg · 15y ago · 0 comments
It was actually quite powerful. But I literally just implemented a state machine. To be honest, I think there were a couple things it did that a regular expression wouldn't be able to do.
However, for the most part, the "efficiency" argument is off base. You can COMPILE regular expressions into tight code.
Rob Pike has written multiple regular expression engines and at least 4 programming languages. I think he understands the efficiency part pretty well.
When I started programming ocaml, I was surprised to find no string primitives for things like split, find, etc... There was only regex. I didn't want to write a regex for doing a simple find or split, so I wrote a string library for my programs. My string library was consistently 4x faster than regex and did only exactly what I wanted.