Package monq.jfa


package monq.jfa

Main entry point to implement Finite Automata, deterministic and nondeterministic and use them for matching. There is an example program available.

A typical use of this package involves the following steps.

  1. Creation of an NFA with an NfaBuilder:
    NfaBuilder<String> b = new NfaBuilder<>()
         .matchRegex("[a-z]+", "ALPHA")
         .or("[0-9]+", "NUM");
  2. Compilation into a DFA with NfaBuilder.compileToDfa().
    Dfa dfa = b.compileToDfa()
  3. Text matching with the Dfa methods:
    assertEquals("NUM", dfa.matchesAtStart("1234 bla bla"))
  4. Or text filtering with DfaFilter.

Alternatively, for matching without the need to retrieve a value, see Regexp.