Regex Tester — Test Regular Expressions Online with Live Highlighting
Build and debug regular expressions in real time with this free online regex tester. Type a pattern, paste your test text, and watch matches highlight instantly — with capture groups broken out so you can see exactly what each part of your expression captured.
A curated library of battle-tested patterns is built in, including regex for email validation, URLs, phone numbers, IPv4 addresses, hex colors, and dates — so you can start from a working pattern instead of a blank slate. Flags like global, case-insensitive, and multiline are toggled with one click, making it easy to understand why a pattern matches in one context and not another.
How to Test a Regular Expression
-
Enter your pattern
Type your regular expression, or pick a ready-made pattern from the built-in library (email, URL, IP address, and more).
-
Set the flags
Toggle g (global), i (ignore case), and m (multiline) to control matching behavior.
-
Paste your test text
Add sample strings — matches are highlighted live as you type, so feedback is immediate.
-
Inspect capture groups
Expand each match to see numbered and named capture groups, perfect for debugging extraction logic.
Features of the Online Regex Tester
-
Live match highlighting
Every match lights up in the test text as you edit the pattern — no run button, no delay.
-
Capture group breakdown
See group-by-group results for every match, including named groups, to debug extraction patterns.
-
Common pattern library
One-click patterns for email, URL, phone, IPv4, hex color, and date validation — a built-in regex cheat sheet.
-
Invalid pattern feedback
Syntax errors in the expression are reported immediately instead of failing silently.
-
Private and fast
Matching runs in your browser with the native JavaScript regex engine — test data is never uploaded.
Frequently Asked Questions
What regex flavor does this tester use?
It uses the JavaScript (ECMAScript) regex engine — the same one running in Node.js and every browser. Patterns tested here behave identically in your JavaScript and TypeScript code.
What is a good regex for validating an email address?
The built-in library includes a practical email pattern that matches the vast majority of real addresses. Note that fully RFC-compliant email regex is famously complex — for critical flows, combine regex validation with a confirmation email.
Why does my regex match only the first occurrence?
You probably need the global flag (g). Without it, JavaScript regex stops after the first match. Toggle the g flag in the tester to match every occurrence.
What are capture groups in regex?
Parentheses create capture groups that extract sub-parts of a match — for example ([\w.]+)@([\w.]+) captures the local part and the domain of an email separately. This tester displays each group for every match.
How do I match across multiple lines?
Enable the m (multiline) flag so ^ and $ anchor to the start and end of each line, and consider the s flag if you need dot to match newlines.