3 ms·
In my experience, it's the edge cases that are a pain when implementing a regex engine. Think about weird regexes like "^*", "$?" (or any quantified zero-width
by perlgeek 9y ago
In my experience, it's the edge cases that are a pain when implementing a regex engine. Think about weird regexes like "^*", "$?" (or any quantified zero-width match), anchors that appear in the middle of regexes, nested quantifiers (don't make much sense, but you need to generate good error messages).
Once you add captures and maybe even backreferences, you get a whole new world of weird :-)
- thesmallestcat 9y agoYou can straight away drop any repetition of a zero-width assertion, no?
- perlgeek 9y agoYou can, but you need to drop the entire zero-width assertion if the repetition allows zero occurrences.