Skip to content

# Regex Laboratory

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).

This is generated in browser and is not sent to pah.moi servers.

About this tool2 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 and cannot backtrack catastrophically. 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.

Use it locally This tool 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