Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 818 Bytes

README.md

File metadata and controls

18 lines (14 loc) · 818 Bytes

Regulus- Matching regular expressions in linear time

Implements the basic ideas described by Russ Cox which basically uses Thompson's Construction to generate a non-deterministic finite automaton. The generated NFA can be used to match strings against a regex in linear time.

This is mainly for educational purposes. If you are searching for a production ready regex engine which doesn't use backtracking, check out google's re2.

Currently supported

  • Quantifiers: "*", "+", "?", "{3,4}"
  • Character classes: "[abc]", "[^abc]"
  • Ranges: "[a-z]"
  • Metacharacters: "\d", "\s", ...
  • Grouping: "(abc)*"
  • Alternation: "a|b"
  • Wildcard: "."

TODO

  • Group extraction
  • ...