Regular Expression Lab

Test a regular expression against sample text and see every match: its byte and character position, the matched text, and any capture groups (by name where named).

About this lab3 paragraphs

Toggle flags, preview a replacement, read a plain-language explanation of the pattern, get performance notes and generated unit tests, and compare three engines side by side: Rust, your browser's JavaScript, and a PCRE-compatible educational mode with backreferences and lookaround.

The Rust engine runs every pattern in linear time, so it cannot get stuck for minutes on an input the way a backtracking engine can. The performance notes below describe backtracking engines (the JS and PCRE modes): they are heuristics about shape, not a proof that any pattern is safe.

The Regex Reference lists the same 99 patterns as a static page with no engine to load: the place to look one up, rather than take one apart.

Use it locally This lab has a native command line twin. Build regex-cli from the site's source with:
cargo build --release --bin regex-cli
Source and licence terms