Regex Tester
Test and debug your regular expressions with real-time pattern matching and detailed results.
How to Use the Regex Tester?
Enter your regular expression pattern and test string to see matches, groups, and positions.
Regular Expression Basics
Regular expressions (regex) are powerful patterns used to match character combinations in strings. They're essential for:
- Data validation (email, phone numbers, etc.)
- Text parsing and extraction
- Search and replace operations
- Input sanitization
Common Regex Patterns
- Email: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
- Phone (US): \(\d{3}\)\s\d{3}-\d{4}
- Date (MM/DD/YYYY): \d{2}/\d{2}/\d{4}
- URL: https?://[^\s]+
- Digits only: ^\d+$
- Alphanumeric: ^[a-zA-Z0-9]+$
Regex Metacharacters
- . - Matches any single character
- * - Matches 0 or more of the preceding character
- + - Matches 1 or more of the preceding character
- ? - Matches 0 or 1 of the preceding character
- ^ - Matches start of string
- $ - Matches end of string
- \d - Matches any digit (0-9)
- \w - Matches any word character
- \s - Matches any whitespace character
Regex Flags
- i (Case insensitive): Makes the pattern case-insensitive
- m (Multiline): ^ and $ match start/end of lines, not just string
- s (Dotall): . matches newline characters
- x (Extended): Allows whitespace and comments in pattern