Regex Tester
Test regex patterns against your text with live highlighting, capture groups and common-pattern shortcuts.
Regular expressions are powerful and easy to get wrong. A pattern that looks right often matches nothing - or worse, matches the wrong things. This tester runs your pattern against your text instantly, highlights every match in place, and shows each capture group with its position, so you can see exactly what the regex engine is doing.
Type a pattern, toggle the flags you need, and watch the matches appear as you type. Common patterns - email, URL, IPv4, phone numbers, ISO dates and usernames - can be loaded with one click, then adapted to your case. Each match is listed with its capture groups, including named groups.
Everything runs in your browser. There is no server round trip and no upload, so you can test patterns against real log lines or payload fragments without them leaving your machine.
/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/giMatches highlighted
Hi alice@example.com, see https://docs.example.com/api/v1/users?id=42 for the details. Our office moved to 203.0.113.10 on 2026-08-15. Call +1 (415) 555-0123 anytime. Follow @dev_alice on the platform for updates.
alice@example.comFeatures
- Live matching: highlights appear in the test text as you type, with no button to press.
- Flag toggles for g, i, m and s, each with a plain-English hint.
- A match list showing every match, its position, and all capture groups - including named groups.
- A quick library of common patterns: Email, URL, IPv4, Phone, Date and Username, loadable in one click.
- Clear error reporting for invalid patterns, so a typo in the expression does not go silent.
- Runs entirely in your browser - your text and patterns are never uploaded.
How to Use
- 1
Enter a pattern
Type a regular expression into the Pattern field. It can be loaded from the quick library first, then adapted. The tester reports invalid syntax immediately.
- 2
Choose your flags
Toggle g (match all, not just the first), i (case-insensitive), m (^ and $ match line starts and ends) and s (dot matches newlines). Each is a small button with a hint.
- 3
Paste test text
The sample text already contains an email, a URL, an IP address, a phone number and a username so you can experiment immediately. Replace it with your own text.
- 4
Read the results
Matches are highlighted inline. Below, each match lists its position and capture groups - group 1, group 2, and named groups by name. Empty groups are marked "(no match)".
Example
Email pattern against sample text
Pattern: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
Flags: gi
Text: Write to alice@example.com or bob@test.org today.↓
2 matches
Match 1 @ 10: alice@example.com
Match 2 @ 32: bob@test.orgCommon Problems
Forgetting the global flag
Without g, most testers and tools return only the first match. The regex engine stops after one hit, which makes it look like your pattern missed text. Toggle g to match every occurrence.
Unescaped characters in the pattern
Characters like . + ( ) [ ] have special meaning. A literal dot must be written \. and a literal plus must be \+. The tester reports a syntax error when a pattern cannot be parsed, which usually points at an unescaped character.
Greedy vs lazy quantifiers
By default, * and + are greedy: they consume as much as possible. In <b>bold</b>, /<b>.*</b>/ matches the whole string, while /<b>.*?</b>/ matches just the first tag. When a match swallows more than expected, reach for the lazy ?.
^ and $ without the m flag
Anchors match the start and end of the whole text by default. Add the m flag to make them match at every line boundary - essential when testing patterns against multi-line logs.
Named groups are not captured with a plain array
When you use (?<name>...), the capture still appears in the positional groups. The tester labels it with the group name so you can map named and positional groups correctly.
Technical Details
Patterns are compiled with the JavaScript RegExp constructor, the same engine your code runs in. The verdict here matches what String.match, RegExp.exec and replace will do in your application.
Matching iterates with the global flag so every match is collected with its index. Zero-width matches - patterns like /^/ or /(?=...)/ that match empty strings - are handled explicitly to avoid infinite loops.
Capture groups are reported positionally and by name. Named groups are extracted from the pattern text, so the tool can label each group even before a successful match.
The quick library contains hand-tested patterns for common formats. They are practical starting points, not exhaustive validators: email and URL patterns in particular accept a deliberate, forgiving subset of real-world input.
All matching happens client-side. The pattern and test text stay in your browser, so nothing about your data is transmitted.
Frequently Asked Questions
Why does my pattern match nothing?
Usually one of a few things: the global flag is off and the match appears only once (or zero times), a metacharacter like . or ( is unescaped, or the pattern is too strict for the actual text. Try loading a common pattern and comparing the differences.
What is the difference between greedy and lazy matching?
A greedy quantifier (*, +) consumes as much text as possible while still allowing the rest of the pattern to match; a lazy one (*?, +?) consumes as little as possible. Greedy is the default and is the usual reason a match extends further than expected.
What do the i, m and s flags do?
i makes matching case-insensitive. m makes ^ and $ match at each line boundary instead of only the start and end of the text. s makes the dot match newlines, so . spans multi-line text. The g flag makes the engine find every match rather than stopping at the first.
Are the quick patterns production-grade validators?
They are practical starting points, not comprehensive validators. Email and URL matching in particular is famously hard to do perfectly; the included patterns cover the common cases and are meant to be tuned for your data.
Is my text or pattern uploaded?
No. All matching runs in your browser. Your pattern and test text never leave your device.
Why does a zero-length match appear in my results?
Patterns like ^, $ or lookaheads can match without consuming any characters. In global matching those produce matches with empty text, and the tester advances past them so it can find the next real match. It is expected behaviour - the empty match usually sits exactly at a boundary your pattern is asserting.
Data & Privacy
Your data stays in your browser. Nothing is uploaded.
- Processing
- Local
- Upload
- None
- Server Storage
- None
- Account
- Not required
Related Tools
Regex Builder
Compose regular expressions from reusable blocks and watch matches highlight live against your test text.
Regex & Text
Text Diff Checker
Line-by-line text comparison that shows every added, removed and unchanged line.
Regex & Text
Regex Escape Tool
Escape every regex metacharacter in a string so it matches literally inside a pattern.
Regex & Text
URL Parser
Break any URL into protocol, host, path, query parameters and fragment for easy inspection.
Encoding & Conversion
JSON Formatter
Format, validate and beautify JSON directly in your browser.
JSON & Data
Random String Generator
Generate secure random strings and passwords with control over length and character set.
Security & Tokens
Related Guides
Regular Expressions Guide: How Regex Works with Examples
Learn regular expressions from scratch: literals, metacharacters, character classes, quantifiers, anchors, groups and flags, with examples you can test online.
Regex Cheat Sheet: Every Metacharacter Explained
A compact regex cheat sheet: anchors, character classes, quantifiers, groups, alternation and flags, with the meaning and an example for every common token.
Email Regex: How to Validate an Email Address
A practical email regex, why the full RFC 5322 pattern is a trap, and how to validate email in HTML5, JavaScript and Python without over-engineering.
URL Regex: How to Match and Validate a URL
Match and validate URLs with regex: protocol, host, path, query and fragment, plus practical patterns and when to use the URL API instead of a regex.
Regex Groups and Capturing: How Grouping Works
Capturing groups, non-capturing groups, named groups and backreferences: what parentheses do in regex and how to extract pieces of a match.