DFIELDSOLUTIONS

Free software

LabStatyx: A regex engine that won't backtrack

A Thompson-construction regex engine: parse → NFA → set-of-states simulation, with bounded quantifiers. 16 tests, including that the “evil” pattern (a|aa)*c matches 60 a's in well under a millisecond.

Free software1 sections · 2 min readBy Dezső Mező.mdFree softwareStatyx

Statyx is a regex engine built the textbook way: it parses the pattern, compiles it to an NFA via Thompson construction, then runs a set-of-states simulation so it never catastrophically backtracks. It supports bounded quantifiers and ships 16 tests, including the classic 'evil' pattern (a|aa)*c matching 60 a's in well under a millisecond. From-scratch and dependency-light, ready to download and run.

01About the app

Automata theory

What to take away

  • A Thompson-construction regex engine: parse → NFA → set-of-states simulation, with bounded quantifiers. 16 tests, including that the “evil” pattern (a|aa)*c matches 60 a's in well under a millisecond.
  • Download: Statyx (ZIP)
We build this for clientsFull-stack

Read the full write-up

More from the lab

Browse all entries

Want this looked at on your own system?Start a conversation

5.0
“New shop, more orders in the first week.”Müller Márk · GeekCornerManaging Director · Hungary