Regex Tester & Explainer — Live Highlights and Plain-English Pattern Breakdown
See every match, capture group, and a token-by-token explanation as you type
Regular expressions are powerful but notoriously hard to read and debug. This regex tester gives you three layers of understanding at once: live match highlighting in your test string (every match is highlighted as you type), a match details panel showing each match's index position and any captured groups, and a token-by-token plain-English explanation of the entire pattern. Type a pattern like the one matching email addresses and see exactly which part matches the local part, which matches the domain, and which matches the TLD — explained in plain English without you having to look anything up.
How to Test and Understand Regular Expressions
Write your pattern and test string — live matches and a plain-English breakdown appear instantly.
Enter your regex pattern
Type your regular expression into the Pattern field. You do not need to add delimiters (no forward slashes). The pattern uses JavaScript regex syntax, which is compatible with most modern languages. Enable flags below the field: g for global (find all matches), i for case-insensitive, m for multiline (^ and $ match line boundaries), and s for dotAll (. matches newline characters).
See live match highlighting
As you type, the test string below shows all matches highlighted in yellow. If you have capture groups (parentheses) in your pattern, each group match is listed separately in the match details table below the test area, showing the matched text and the character position. Overlapping matches are handled gracefully.
Read the pattern explanation
The Explanation panel below the pattern field tokenizes your regex and explains each component in plain English. For example, the pattern for digit sequences is explained as: one or more digit characters (0-9). Anchors, quantifiers, character classes, lookaheads, and named groups are all explained individually so you understand exactly what each part of your pattern does.
Features
Live match highlighting in the test string as you type
Match details table with matched text, index, and capture group values
Token-by-token plain-English explanation of the full pattern
Supports all four JavaScript regex flags: g, i, m, s
Capture group support including named groups
Handles complex patterns with lookaheads and non-capturing groups
Copy button for the regex pattern
Runs entirely in your browser — no data sent to a server
Related Tools
Frequently Asked Questions
What regex engine does this tester use?
This tester uses the JavaScript regex engine built into your browser. JavaScript regex is compatible with most general-purpose regex patterns but has some differences from PCRE (used in PHP, Python, and most other languages) — notably, JavaScript does not support lookbehind assertions in older engines and uses different syntax for named capture groups. Modern Chrome and Firefox support all ES2018 regex features including lookbehind.
What do the regex flags g, i, m, and s do?
g (global) finds all matches instead of stopping at the first one. i (case-insensitive) makes the pattern match uppercase and lowercase letters equally. m (multiline) makes ^ match the start of each line and $ match the end of each line instead of the start and end of the entire string. s (dotAll) makes the . character match newline characters in addition to all other characters.
How do I match a literal dot or other special character?
In regex, the dot (.) matches any character. To match a literal dot, escape it with a backslash: a period is written as a backslash followed by a dot. The same applies to other special regex characters: parentheses, brackets, braces, caret, dollar sign, asterisk, plus, question mark, pipe, and backslash itself each need a preceding backslash to be treated as literals.
What is a capture group and how do I use it?
A capture group is a part of a pattern enclosed in parentheses. It both matches and remembers the text it captures. For example, a pattern with parentheses around the year part of a date pattern will capture just the year as group 1. You can reference capture groups in replacement strings as dollar-sign-1, dollar-sign-2, etc., or by name if you use named groups.
How do I write a regex to match email addresses?
A common and practical email regex matches one or more word characters or dots or hyphens before the at sign, then a domain with at least one dot. In JavaScript it can be written as a pattern starting with word characters and dots, an at symbol, domain parts separated by dots, ending with a two-to-six letter TLD. Perfect email validation is complex; for most purposes, check for the presence of an at symbol and a dot after it and defer true validation to a server-side check.