Regex Tester
Free online regex tester tool. Test and debug regular expressions with real-time matching, syntax highlighting, capture groups, and flag support. Perfect for developers working with pattern matching and text processing.
Regex Tester - Test and Debug Regular Expressions Online
A powerful online regular expression tester that helps you test, debug, and learn regex patterns. Features real-time matching with syntax highlighting, capture group display, all JavaScript regex flags support, and detailed match information. Perfect for developers and anyone working with pattern matching.
What is a Regular Expression (Regex)?
A regular expression (regex) is a sequence of characters that defines a search pattern. It's used for:
- Pattern matching in strings
- Find and replace operations
- Input validation (emails, phone numbers, URLs)
- Text parsing and extraction
- Data cleaning and transformation
For example, the pattern /\d{3}-\d{3}-\d{4}/ matches phone numbers like 555-123-4567.
How do I use this Regex Tester?
Using the regex tester is simple:
1. Enter your regex pattern in the 'Regular Expression Pattern' field
2. Enter the text you want to test in the 'Test String' field
3. Select the flags you need (g for global, i for case-insensitive, etc.)
4. Click 'Test Regex' to see the results
5. View matches highlighted in the text and detailed match information
The tool will show you all matches, capture groups, and match positions in real-time.
What are Regex Flags?
Regex flags modify how the pattern matching works:
- g (Global): Find all matches instead of stopping after the first match
- i (Case Insensitive): Match regardless of uppercase/lowercase
- m (Multiline): ^ and $ match start/end of lines, not just start/end of string
- s (Dotall): The . character matches newline characters
- u (Unicode): Treat pattern as Unicode code points
- y (Sticky): Match only from the lastIndex position
You can combine multiple flags, like 'gi' for global case-insensitive matching.
What are Capture Groups?
Capture groups are parts of a regex pattern enclosed in parentheses ( ) that extract specific portions of the matched text.
For example:
- Pattern: (\d{3})-(\d{3})-(\d{4})
- Text: 555-123-4567
- Group 1: 555
- Group 2: 123
- Group 3: 4567
Capture groups are useful for:
- Extracting specific parts of matches
- Backreferences in the pattern
- Replace operations with captured values
This tool displays all capture groups for each match, making it easy to see what was captured.
Common Regex Patterns
Here are some commonly used regex patterns:
- Email: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
- URL: https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b
- Phone: \d{3}-\d{3}-\d{4} or \(\d{3}\) \d{3}-\d{4}
- Date (YYYY-MM-DD): \d{4}-\d{2}-\d{2}
- IP Address: \b(?:\d{1,3}\.){3}\d{1,3}\b
- Hex Color: #[0-9a-fA-F]{6}\b
- Username: ^[a-zA-Z0-9_]{3,16}$
You can test these patterns directly in this tool to understand how they work.
Is my data safe?
Yes, your data is completely safe and private:
- All regex testing happens in your browser
- No data is sent to any server
- We don't store or log any patterns or test strings
- Works offline after the page loads
- Open-source client-side processing
You can verify this by checking your browser's network tab - there are no requests sent when testing regex patterns.
Key Features
- Test regular expressions with real-time matching
- Syntax highlighting for matches
- Display all capture groups
- Support all JavaScript regex flags (g, i, m, s, u, y)
- Show match count and positions
- Highlight matches in test string
- Detailed error messages for invalid patterns
- Copy and paste functionality
- Upload text files for testing
- Dark mode support
- 100% client-side processing - data never leaves your browser
- Works offline after initial load
- Mobile-friendly responsive design