Hacker News new | ask | show | jobs
by jason-johnson 3113 days ago
Depending on how it’s being counted, I have a regex engine in around 30 lines [1] (the parser is longer). It handles branching, grouping, etc. and it’s run time is proportional to the length of the string being searched (I.e. no infinite loops on certain patterns, etc.).

[1] https://github.com/jason-johnson/frobo/blob/master/src/Text/...

The “match” function. And yes, this is ugly and needs to be cleaned up.