Skip to content

borailgar/YAREGeX

Repository files navigation

YAREGeX

Yet another tiny Regular Expression matching library. Compiles NFA from regex string and simulates NFA using Thompson's algorithm.

Implements 2/3 states:

  1. Infix notation to postfix (Supports only (|), * + ?)
  2. Regular Expression to NFA
  3. NFA to DFA (not yet)

Test

    // Crates NFA state from infix regex string
    auto nfa_state = lambda::make_nfa({"a.(a+b)*.b"});
    // Initialize matching state 
    lambda::RgxMatch rgx_match(nfa_state);
    if(rgx_match.match("abba")) {
        // ...
    } else {
        // does not match with given string
        return;
    }