.*

Regex Tester

Test JavaScript regular expressions live — see matches highlighted as you type.

regex-tester
//
// test string

About Regex Tester

Regular expressions are one of the most powerful and most misunderstood tools in a developer's toolkit. This regex tester lets you write a pattern, set flags (global, case-insensitive, multiline, dotAll), and see every match highlighted in your test string in real time. The tool uses JavaScript's native RegExp engine, so results match exactly what you'd get in Node.js, browser JavaScript, or any JS runtime. No translation layer, no guessing — what you see here is what your code will see. As you type, the match count updates instantly and each match is highlighted with its capture groups listed below. This makes it easy to iterate on complex patterns — tweak a quantifier, add a lookahead, adjust a character class — and immediately see the effect. Useful for validating email addresses, phone numbers, URLs, and date formats; extracting data from log files; parsing structured text; writing search-and-replace patterns for editors; and understanding patterns in third-party code. The flags panel supports g (global), i (case-insensitive), m (multiline), and s (dotAll) — the same flags supported by JavaScript's RegExp.

Frequently Asked Questions

What regex flavor does this tester use?
JavaScript (ECMAScript) regex via the built-in RegExp object. This matches behavior in Node.js, V8, SpiderMonkey, and all modern browsers. It supports standard features like lookaheads, lookbehinds, named capture groups, and Unicode property escapes (with the u flag).
What do the flags g, i, m, and s do?
g (global) finds all matches instead of stopping at the first. i (case-insensitive) treats A and a as the same. m (multiline) makes ^ and $ match the start/end of each line, not just the whole string. s (dotAll) makes the . character match newlines too.
How do I match a literal dot or parenthesis?
Escape them with a backslash: \. matches a literal dot, \( matches a literal opening parenthesis. In a regex pattern, unescaped . means "any character" and ( starts a capture group.
Why does my regex match too much or too little?
Quantifiers (*, +, ?) are greedy by default — they match as much as possible. Add ? after them to make them lazy: .*? matches the shortest possible string. Also check your anchors: ^ and $ only match line boundaries with the m flag, otherwise they match the whole string start/end.
Can I use named capture groups?
Yes. Use (?<name>...) syntax. Named groups make your pattern self-documenting and let you reference captures by name in replacement strings: str.replace(/(?<year>\d{4})/, "$<year>"). The tester shows named group values in the match details.