Regex Tester — Live Match Highlighting
Test a pattern against real input with matches highlighted as you type, capture groups broken out, and each token of the pattern explained.
Why the same pattern behaves differently across languages
This tester uses the JavaScript engine. Most patterns port unchanged, but these differences cause real bugs when moving between languages:
| Feature | JavaScript | Python | PCRE / PHP |
|---|---|---|---|
| Named groups | (?<n>…) | (?P<n>…) | Both forms |
| Lookbehind | Yes, any length | Fixed width only | Fixed width only |
| Atomic groups | No | Yes (3.11+) | Yes |
| Possessive quantifiers | No | Yes (3.11+) | Yes |
| Start/end of string | ^ $ with m flag | \A \Z | \A \z |
| Dot matches newline | s flag | re.DOTALL | s modifier |
| Unicode property escapes | \p{…} with u flag | Via the regex module | \p{…} |
| Recursion | No | No | Yes (?R) |
The lookbehind difference bites most often: JavaScript allows variable-length lookbehind, so a pattern developed here may fail to compile in Python or PHP.
Flags and capture groups
/pattern/g // global — find all matches, not just the first
/pattern/i // ignore case
/pattern/m // multiline — ^ and $ match at line breaks
/pattern/s // dotAll — . also matches newline
/pattern/u // unicode — enables \p{...}, correct surrogate handling
/pattern/y // sticky — match only at lastIndex
/pattern/d // indices — expose start/end offsets per groupconst re = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/;
const { groups } = '2026-09-01'.match(re);
groups.year; // '2026'
// Positional groups break the moment someone inserts
// a group earlier in the pattern. Named ones do not.// matchAll needs the g flag and yields full match objects
for (const m of text.matchAll(/(\w+)@(\w+\.\w+)/g)) {
console.log(m[0], m.index, m[1], m[2]);
}
// A common bug: a /g regex object carries lastIndex between
// calls, so reusing one across .test() calls alternates
// true/false. Create it fresh, or reset re.lastIndex = 0.Where a regex is the wrong tool
- Parsing HTML or XML —Nested, arbitrarily deep structures cannot be matched by a regular language. Use a parser — every language has one built in or a line away.
- Validating email addresses —The RFC 5322 grammar is genuinely baroque, and the compliant regex is famously several thousand characters. Check for an @ with something either side, then send a confirmation email — delivery is the only real validation.
- Parsing CSV —Quoted fields containing commas and embedded newlines defeat any single-line regex. Use a CSV parser, or the CSV converter.
- Matching balanced delimiters —Nested brackets or parentheses need a stack. PCRE recursion can do it; JavaScript cannot, and it is unreadable either way.
- Anything on untrusted input in a hot path —See the backtracking warning above. A string method or a parser is usually both faster and safer.
About
The Regex Checker lets you write and test JavaScript regular expression patterns against any input text, with match highlighting that updates as you type — no button press needed. Every match is highlighted inline in the test string, and a details panel shows each match's index, length, full value, and the values of all capture groups, including named groups using the (?<name>...) syntax. All five JavaScript regex flags are available as toggles: g (global), i (case-insensitive), m (multiline), s (dotAll), and u (Unicode). A built-in cheatsheet covers the most common regex constructs — character classes, anchors, quantifiers, groups, and lookaheads — and each entry is clickable to insert the construct directly into your pattern field. Everything runs in your browser using the native JavaScript RegExp engine, so results are exactly what you will see in Node.js, Chrome, and other V8-based runtimes.
How to use
- 1 Enter your regular expression pattern into the Pattern input at the top — do not include the surrounding slashes.
- 2 Toggle the flags you need using the flag buttons: g (global — find all matches), i (case-insensitive), m (multiline), s (dotAll — dot matches newlines), or u (Unicode mode).
- 3 Type or paste your test string in the Test String panel — matches are highlighted live in green as you type.
- 4 Inspect the match details in the Matches panel: each match shows its position, length, and the value of every capture group.
- 5 For named capture groups, use the (?<name>...) syntax in your pattern — the panel labels each group by name.
- 6 Open the Cheatsheet panel and click any construct (e.g. \d+, (?=...), [a-z]) to insert it at the cursor in the Pattern field.
- What regex engine does this tool use?
- The tool uses JavaScript's native RegExp engine — the same one built into Node.js, Chrome, Firefox, Edge, and Safari. This means results are exactly what you will see when you use your regex in JavaScript or TypeScript code. If you are writing a regex for a different language (Python, Java, Go), be aware that syntax differences exist, especially for lookaheads, lookbehinds, and named group syntax.
- What regex flags are supported?
- All five JavaScript regex flags are supported: g (global — find all non-overlapping matches rather than stopping after the first), i (case-insensitive matching), m (multiline — ^ and $ match start and end of each line, not just the whole string), s (dotAll — the dot metacharacter matches newline characters), and u (Unicode mode — enables full Unicode matching and the \p{...} property escapes).
- How do named capture groups work?
- Named capture groups use the syntax (?<groupname>pattern). For example, (?<year>\d{4}) captures four digits and names the group "year". The Matches panel displays both the numbered index and the name for each captured group, so you can verify your naming logic without guessing which index corresponds to which group.
- How is this different from regex101.com?
- regex101.com is a powerful multi-flavour tool with detailed explanations. This tool focuses specifically on the JavaScript RegExp engine and prioritises speed and privacy: no data is sent to any server, there is no account required, and the clickable cheatsheet lets you build patterns without leaving the editor. It is optimised for developers who need a fast, private JavaScript regex scratchpad.
- Is my test string or pattern sent to a server?
- No. Pattern matching runs entirely in your browser using the native JavaScript RegExp engine. Neither your pattern nor your test string is transmitted anywhere, which makes it safe to test regexes against log lines, PII, or any other sensitive text.
The full guide
More in Developer Tools
See all developer tools.