Regex Tester
Test regular expressions with instant visual feedback
Regular Expression
Common Patterns
Sample Texts
0 Matches Found
Test Text
Highlighted Matches
Free Online Regex Tester — Test Regular Expressions Instantly
Regular expressions are one of the most powerful tools in a developer's toolkit. They let you search, match, and manipulate text using patterns. But writing the right regex can be tricky — a single misplaced character can change the entire behaviour. That is where a live regex tester becomes essential. Instead of running your code, deploying, and checking logs, you can test your pattern right here and see every match highlighted instantly.
This free Regex Tester supports all six JavaScript regex flags: global (g), case-insensitive (i), multiline (m), dotAll (s), unicode (u), and sticky (y). Type your pattern, paste your test string, and watch matches appear in real time. Every match is colour-coded and numbered. Capture groups are shown separately. You can also use the built-in replace mode to test find-and-replace operations.
Eight common patterns are built in — email, URL, phone number, hex colour, IP address, date, HTML tag, and plain numbers. Four sample texts are provided so you can test patterns instantly. All processing runs in your browser. No data is sent to any server.
Understanding Regex Flags
g — Global
Find all matches in the string, not just the first one. Without this flag, the regex stops after the first match.
i — Case-insensitive
Treat uppercase and lowercase letters as the same. "abc" matches "ABC", "Abc", and so on.
m — Multiline
Make ^ and $ match the start and end of each line, not just the start and end of the entire string.
s — DotAll
Make the dot (.) match newline characters as well. By default, dot matches everything except newlines.
u — Unicode
Enable full Unicode support. Required for matching emoji, CJK characters, and other multi-byte sequences correctly.
y — Sticky
Match only from the position indicated by lastIndex. Useful for tokenisation and lexer implementations.
Common Regex Patterns Explained
Email validation
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,} — Matches standard email addresses with alphanumeric local parts and domain names.
URL matching
https?://[\w\-]+(\.[\w\-]+)+[/#?]?.* — Matches HTTP and HTTPS URLs with domain names, paths, and query strings.
Phone numbers
\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4} — Matches US phone numbers in various formats: (123) 456-7890, 123-456-7890, 123.456.7890.
IP addresses
\b(?:\d{1,3}\.){3}\d{1,3}\b — Matches IPv4 addresses like 192.168.1.1. Does not validate range (0-255).
Dates
\d{4}-\d{2}-\d{2} — Matches dates in YYYY-MM-DD format. Does not validate month or day ranges.
HTML tags
<[^>]+> — Matches opening and closing HTML tags including self-closing tags. Not suitable for full HTML parsing.
