Regex Tester & Explainer
Test regular expressions against sample text with live match highlighting and a token-by-token explanation.
How the Regex Tester & Explainer works
Patterns are compiled with the JavaScript RegExp engine, the same one your browser and Node.js use, so matches here behave identically in your code. Every match is highlighted in the test string and capture groups are listed separately.
The explainer breaks the pattern into tokens such as anchors, character classes, quantifiers and groups and describes each in plain English, which makes inherited or complex expressions easier to audit.
How to use the Regex Tester & Explainer in 3 steps
Step 1
Enter a pattern or pick a preset such as Email, Phone or URL.
Step 2
Toggle the g, i, m and s flags as needed and type or paste your test text.
Step 3
Review the highlighted matches, capture groups and token-by-token explanation.
Frequently asked questions
What do the g, i, m and s regex flags do?
g finds all matches instead of the first, i ignores case, m makes ^ and $ match at line breaks, and s lets the dot match newline characters.
What is a good regex for validating email addresses?
A practical pattern is ^[^\s@]+@[^\s@]+\.[^\s@]+$, which is available as the Email preset. Fully RFC 5322-compliant patterns exist but are long; confirm addresses by sending a verification email.