🔍 Regex Tester
Write, test, and debug regular expressions with live match highlighting, group capture, and find-and-replace — entirely in your browser.
About Regex Tester
Regular expressions (regex) are patterns used to search, match, extract, and transform text. They are built into virtually every programming language — JavaScript, Python, Java, Go, Ruby — and are indispensable for input validation, log parsing, data extraction, and text processing. Writing a correct regex and testing it against real data is notoriously tricky, which is why a live tester that shows matches as you type is such a useful tool.
This browser-based regex tester highlights all matches in your test text in real-time, shows every capture group for each match, and supports find-and-replace with backreferences. It also includes 16 pre-built patterns for common Indian and international formats — email, phone, PAN card, Aadhaar, IFSC code, IPv4/IPv6, URL, date, time, hex colour, credit card, JWT, UUID, and HTML tags. All processing is entirely client-side.
How to test a regular expression
- Enter your regex pattern in the Pattern field (without the surrounding slashes).
- Toggle the flags you need:
g(global — find all matches),i(case-insensitive),m(multiline),s(dot matches newline),u(unicode). - Type or paste your test text. Matches highlight immediately.
- Expand any match in the list to inspect its capture groups.
- Switch to Replace mode, enter a replacement string using
$1,$2, or named group references ($<name>), and see the result instantly. - Or click a Common Pattern to load a ready-made regex for email, phone, PAN, UUID, and more.
Features
🔍 Live matching
All matches highlight in real-time as you type your regex — no submit button needed. Each match is listed with its index and matched text.
🎯 Capture groups
Expand any match to see all numbered and named capture groups. Named groups (?<name>...) are shown by their name for clarity.
⇄ Find & Replace
Switch to Replace mode, enter a replacement with $1 $2 backreferences or named group refs, and see the full substituted output.
🚩 Regex flags
Toggle g (global), i (case-insensitive), m (multiline — ^ and $ match line boundaries), s (dot-all), and u (full unicode) with one click.
📋 Common patterns
16 ready-made patterns: Email, Indian Phone, PAN, Aadhaar, IFSC, IPv4, IPv6, URL, Date, Time, Hex color, Credit card, JWT, UUID, HTML tag.
🛡️ Privacy
100% client-side using the browser's native RegExp engine. Your test strings and patterns never leave your browser.
Frequently Asked Questions
What regex flavour does this tester use?
It uses JavaScript's built-in RegExp engine (ECMAScript regex). This is the same engine used in browsers and Node.js. It supports lookahead and lookbehind assertions, named capture groups, Unicode property escapes (with the u flag), and the s (dotAll) flag. It does not support atomic groups or possessive quantifiers, which are PCRE-only features.
How do I use named capture groups?
Named groups use the syntax (?<name>pattern). For example, (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) matches a date and captures three named groups. In the match list, named groups appear by name. In replace mode, reference them as $<year>, $<month>, $<day>.
Why is my regex matching too much (greedy)?
By default, quantifiers like *, +, and {n,m} are greedy — they match as much as possible. Add a ? after the quantifier to make it lazy (minimal): .* becomes .*?, .+ becomes .+?. Lazy quantifiers match as little as possible, which is usually what you want when parsing structured text.
What does the 'm' (multiline) flag do?
Without m, ^ matches only the start of the entire string and $ matches only the end. With m enabled, ^ matches the start of each line and $ matches the end of each line. This is essential when processing multi-line text and wanting to match per-line patterns.
How do I match a literal dot, bracket, or other special character?
Special regex characters (. * + ? ^ $ { } [ ] | ( ) \) must be escaped with a backslash to match literally. For example, to match a literal dot use \., to match a literal parenthesis use \(, and to match a backslash itself use \\.