Character Classes
[abc]- Match a, b, or c[a-z]- Match any lowercase letter[^abc]- Match anything except a, b, or c\d- Match any digit (0-9)\w- Match word characters (a-z, 0-9, _)\s- Match whitespace
Test and debug regular expressions with live match highlighting, capture groups, and replacement preview. Instantly see all matches and details. Your data is processed locally in your browser and never uploaded.
Enter a JavaScript regular expression pattern (without slashes). For example: ^\w+@\w+\.\w+$
Paste or enter the text you want to test against the regex pattern.
Type your regular expression pattern without the forward slashes. For example: ^\w+@[\w.]+$ to match email-like patterns.
Choose regex flags: g for global (find all matches), i for case-insensitive, m for multiline, or s for dot-all mode.
Paste or type the text you want to test against your pattern. All processing happens in your browser.
See all matches highlighted in the text, with details like position and capture groups. Optionally preview a replacement.
A regular expression (regex) is a pattern that matches characters in text. Use special characters to create powerful search and validation rules.
[abc] - Match a, b, or c[a-z] - Match any lowercase letter[^abc] - Match anything except a, b, or c\d - Match any digit (0-9)\w - Match word characters (a-z, 0-9, _)\s - Match whitespace* - Zero or more times+ - One or more times? - Zero or one time (optional){ 3} - Exactly 3 times{ 3,5} - Between 3 and 5 times{ 3,} - 3 or more times^ - Start of string (or line with m flag)$ - End of string (or line with m flag)\b - Word boundary\B - Non-word boundary(pattern) - Capture group(?:pattern) - Non-capturing groupa|b - Match a or b. - Any character (except newline)Validates basic email format
Matches HTTP/HTTPS URLs
Pattern:
^https?:\/\/[\w.-]+\.[a-z]{2,}Example: https://example.com/path
Matches various US phone formats
Pattern:
^\(?\d{3}\)?[- ]?\d{3}[- ]?\d{4}$Example: (555) 123-4567
Matches ISO date format
Pattern:
^\d{4}-\d{2}-\d{2}$Example: 2024-10-25
Matches hex color codes
Pattern:
^#?[0-9a-fA-F]{6}$Example: #FF5733 or FF5733
Matches text with letters and spaces only
Pattern:
^[a-zA-Z\s]+$Example: Hello World
gFind all matches in the string. Without this flag, only the first match is returned.
iMatch uppercase and lowercase characters. For example, /hello/i matches "HELLO", "Hello", and "hello".
mMake ^ and $ match the start/end of lines, not just the start/end of the entire string. Useful for multiline text.
sMake the . metacharacter match any character, including newlines. By default, . matches any character except newlines.
Test regex patterns for form validation, such as email, phone numbers, and password requirements.
Use capture groups to extract specific parts of text, like domain from URLs or area code from phone numbers.
Test replacement patterns before using them in code to transform text or reformat data.
Troubleshoot regex patterns by testing them with real data and viewing detailed match results.
Experiment with different patterns and see immediate results. Perfect for learning regex syntax and behavior.
Search for complex patterns in large text, logs, or code. See all matches highlighted and detailed.
This tool uses JavaScript regular expressions. The RegExp syntax is largely consistent across programming languages, but some advanced features may differ. Test patterns for your specific language or framework.