Tester & Evaluator of Regular Expressions (Regex)
Write a regular expression and see matches, the explanation and copy-ready code, all live.
Test string
Step-by-step explanation
Type a regular expression to get started.
Copy-ready code
Pick your language and copy the snippet.
const regex = //g;
const isMatch = regex.test(input);
const allMatches = [...input.matchAll(new RegExp(regex.source, regex.flags.includes("g") ? regex.flags : regex.flags + "g"))];Cheat Sheet — quick reference
Regex Engine Architecture & Pattern Matching
DFA vs NFA engines, ReDoS prevention, capture groups, and lookaround assertions.
JavaScript and Python rely on NFA engines allowing backreferences and lookarounds, which introduces potential backtracking overhead compared to linear DFA engines.
Nested quantifiers like `(a+)+$` cause exponential step explosions when failing near the end of strings, locking CPU threads in single-threaded environments.
Non-capturing groups `(?:...)` cluster subexpressions without allocating match slots or capturing overhead, boosting throughput in high-volume parsing.
Lookaheads and lookbehinds assert surrounding context without consuming characters, essential for multi-rule password policies and currency parsing.
Regex Performance, Escaping & Matching Troubleshooting
Step-by-step fixes for ReDoS locks, JavaScript lastIndex bugs, string escaping, and greedy matching.
CPU Spikes to 100% & UI Freezes (Catastrophic ReDoS)
JavaScript `regex.test()` Alternates Between True and False
Backslashes Stripped in Programming String Literals
Greedy Matching Consuming Multiple Tags/Lines
Did You Know? Regex History & Trivia
Zawinski's iconic quote, the Unix grep origin, and 1951 neural network foundations.
Jamie Zawinski's Legendary 1997 Quote
"Some people, when confronted with a problem, think 'I know, I'll use regular expressions.' Now they have two problems." Became software engineering's most famous quip.
Invented in 1951 to Model Biological Neural Circuits
Mathematician Stephen Kleene invented regular algebra to mathematically describe firing patterns in biological neural circuits.
How the Unix 'grep' Command Got Its Name
Ken Thompson added regex to Unix `ed`. The command `g/re/p` (Global Regular Expression Print) became the standalone utility `grep`.
PCRE: The C Engine Powering the Global Web
Written by Philip Hazel in 1997, PCRE powers Apache, Nginx, PHP, and hundreds of mission-critical systems worldwide.