Regex Tester - Test Regular Expressions Online
Write and test regular expressions against sample text in real-time. See matches highlighted, inspect capture groups, and get flags control.
Test patterns against the text and edge cases that matter
A regular expression can match the sample you expected and still fail on empty values, line breaks, Unicode text, or an unexpectedly long input. This tester shows matched spans and capture groups while you build a focused set of positive and negative examples. Compare changed samples with the text diff tool, or prepare consistent fixtures with the case converter.
Live highlighting
Matches are highlighted in yellow as you type your pattern - No submit button needed - Making iterative refinement instant.
Capture group display
Named and numbered capture groups are listed separately so you can verify each group extracts exactly the right substring.
Flag controls
Toggle global, case-insensitive, multiline, and dotAll flags individually to see how each changes the match results.
Common regex patterns
These battle-tested patterns cover the most common validation and extraction tasks. Copy and adapt them in the tester above.
| Pattern | Regex | Notes |
|---|---|---|
| Email address | [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,} | Basic validation - Use HTML5 type="email" for forms |
| URL (http/https) | https?://[^\s/$.?#].[^\s]* | Matches http and https URLs in plain text |
| IPv4 address | \b(?:\d{1,3}\.){3}\d{1,3}\b | Matches the pattern - Does not validate octet ranges (0–255) |
| Date (YYYY-MM-DD) | \d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01]) | ISO 8601 date format with month/day range validation |
| Phone (US) | (?:\+1[-.\s]?)?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4} | Handles common US phone number formats with optional country code |