Regex Tester
Test and debug regular expressions with real-time pattern matching. See matches, capture groups, and detailed results instantly.
Test Your Regex Pattern
Enter your regex pattern without delimiters (no need for //)
About Regex Tester
Our Regex Tester is a powerful tool for testing and debugging regular expressions. Whether you're validating user input, extracting data, or searching for patterns, this tool provides real-time feedback with detailed match information, capture groups, and position tracking.
How to Use the Regex Tester
- Enter your regular expression pattern in the pattern field
- Select the flags you need (g for global, i for case-insensitive, etc.)
- Enter or paste your test string in the text area
- Click "Test Regex" to see all matches and detailed results
- View highlighted matches, capture groups, and position information
- Adjust your pattern and test again until you get the desired results
Understanding Regex Flags
- g (Global): Find all matches instead of stopping after the first match
- i (Case-insensitive): Ignore case when matching (A = a)
- m (Multiline): ^ and $ match the start/end of each line
- s (DotAll): Dot (.) matches newline characters
- u (Unicode): Enable full unicode support
- y (Sticky): Match only from the lastIndex position
Common Use Cases & Examples
📧 Email Validation
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}Validates email addresses with standard format
📱 Phone Number (US)
\d{3}-\d{3}-\d{4}Matches phone numbers in format: 123-456-7890
🔗 URL Extraction
https?://[^\s]+Extracts HTTP and HTTPS URLs from text
📅 Date Format (YYYY-MM-DD)
\d{4}-\d{2}-\d{2}Matches dates in ISO format: 2024-01-15
🔐 Password Strength
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$Requires: 8+ chars, uppercase, lowercase, number, special char
🏷️ HTML Tag Matching
<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)Matches HTML tags with content or self-closing tags
🌐 IP Address (IPv4)
\b(?:\d{1,3}\.){3}\d{1,3}\bMatches IPv4 addresses like 192.168.1.1
Frequently Asked Questions
What are capture groups?
Capture groups are parts of your regex pattern enclosed in parentheses (). They allow you to extract specific portions of the matched text. For example, in the pattern (\d+)-(\d+), the two groups of digits are captured separately.
How do I use named capture groups?
Named capture groups use the syntax (?<name>pattern). For example, (?<year>\d{4})-(?<month>\d{2}) creates groups named "year" and "month" that you can reference by name.
Why should I use the global (g) flag?
The global flag tells the regex engine to find all matches in the string, not just the first one. Without it, the regex stops after finding the first match. Use it when you want to find all occurrences of a pattern.
Is my regex pattern saved or sent to a server?
No, all regex testing is done entirely in your browser using JavaScript. Your patterns and test strings are never sent to any server, ensuring complete privacy and security.
Can I test multiline patterns?
Yes! Enable the multiline (m) flag to make ^ and $ match the beginning and end of each line instead of just the beginning and end of the entire string. This is useful for processing text with multiple lines.