4 ms·
I already knew Perl and Posix regex when I took automata. I cruised through the initial basics of regular expressions faster than my peers. But I got into troub
by forgettableuser 11y ago
I already knew Perl and Posix regex when I took automata. I cruised through the initial basics of regular expressions faster than my peers. But I got into trouble after I learned that regex contains a bunch of features (hacks) that have no grounding in pure automata theory. I had to unlearn a whole bunch of things.
- dottrap 11y agoProfessor Roberto Ierusalimschy (creator of Lua), was bothered by the problems of regex deviating from (real) regular expressions, like how captures create non-determinism, back references make pattern matching algorithms NP complete, no formally defined performance model, and so on. This led him to revisit prior research on PEGs (Parseable Expression Grammars) which are akin to Context-Free Grammars. He created a library called LPeg which was a PEG for Lua. He gave a talk about all this which can be found here: https://vimeo.com/1485123 https://vimeo.com/1485123 So he basically realized people were hacking regular expressions to get more power. So rather than playing that game, he climbed up a level on the automata ladder to get a more mathematically sound approach to the problem.
- gnuvince 11y agoRegarding that, since I took that class I've been careful about using the term "regular expression" for expressions that describe a NFA and "regex" for what popular languages implement.