Regex Tester
Test regular expressions
Regex Tester: Test Regular Expressions in Real Time
Regular expressions (regex) are one of the most powerful tools for text manipulation and validation. Our tester allows you to build and validate patterns interactively, with immediate visual feedback.
Compatible with the JavaScript regex flavor (ECMAScript). Includes highlighted matches, capture groups, flags (g, i, m, s, u), and step-by-step explanation of your pattern.
Ideal for validating emails, URLs, phone numbers, dates, or extracting data from unstructured text. All computation happens in the browser — no data leaves your device.
How does it work?
- 1Write your regex
Enter the pattern in the regex field without delimiters (e.g., use '\d+' not '/\d+/g').
- 2Add flags
Select the flags you need: g (global), i (case-insensitive), m (multiline), s (dotall), u (unicode).
- 3Enter test text
Paste the text where you want to search. Matches will be highlighted and shown with their capture groups.
Frequently Asked Questions
.* matches zero or more of any character, while .+ requires at least one. Both are greedy — they consume as much as possible. Use .*? or .+? for lazy matching.
A practical pattern is: ^[^\s@]+@[^\s@]+\.[^\s@]+$. Don't use overly strict patterns — the official RFC 5322 for emails is very complex. Better validate format and confirm via email.
You may have catastrophic backtracking. Patterns like (a+)+ or (.*)* can cause exponential explosion. Use possessive quantifiers or atomic groups, or restructure the pattern.