Skip to content
Tape‑n‑Trace
PracticeSearch 26 tools

Text and keyword search

The application that makes finite automata feel like engineering. Give it some keywords and some text, and watch the head scan — with both machines shown side by side so the cost of guessing is visible.

Hopcroft 2e §2.4.

Try:

The scan

Hover or focus a character to see where the DFA had got to after reading it. Highlighted runs are matches — overlapping ones are all reported.

2 matches: "web" at 0, "ebay" at 1.

The guessing NFA

§2.4.2 — 8 states, 12 transitions

a, b, e, w, ywebebaystartk0:wk0:wek0:webk1:ek1:ebk1:ebak1:ebay

One chain per keyword, and a start state that loops on everything so a keyword may begin anywhere.

The recognising DFA

§2.4.3 — 8 states, 40 transitions

a, b, yewa, ybewa, b, yewab, yewa, ybewa, bewyab, yewa, b, yewstartewebweebawebebay

One state per keyword prefix. It never guesses, so it reads each character exactly once.