Regular Expression Tester
Test and debug regular expression patterns with instant match results and replacement functionality
Match Results
Match Details
Quick Patterns
Replace Function
About Regular Expression Tester
The Regular Expression Tester is a powerful tool for testing and debugging regular expressions in real-time. It provides instant feedback on pattern matching, highlighting matches in your test text and showing detailed match information.
This tool supports all JavaScript regex flags and provides quick access to common patterns. Whether you're validating user input, parsing data, or learning regex syntax, this tester makes the process interactive and visual.
How to Use This Tool
- Select a quick template or enter your regular expression pattern
- Set appropriate flags (g for global, i for ignore case, m for multiline)
- Enter or load sample test text
- View real-time match results and details
- Use replace function to test replacement operations
Key Features
- Real-time regex testing with instant visual feedback
- Support for all JavaScript regex flags (g, i, m, s, u, y)
- Syntax highlighting for matched text
- Detailed match information with groups and positions
- Quick access to common regex patterns
- Copy functionality for matched results
- Multi-line text support with proper formatting
Regular Expression Flags
gimUsage Tips
- Use the Global flag (g) to find all matches in your text
- Test your regex with various input samples to ensure accuracy
- Use capturing groups () to extract specific parts of matches
- The Ignore Case flag (i) is useful for case-insensitive searches
- Use \b for word boundaries to match whole words only
- Test edge cases like empty strings and special characters
Common Regular Expression Patterns
\dAny digit (0-9)\wWord characters (a-z, A-Z, 0-9, _)\sWhitespace characters.Any character except newline+One or more*Zero or more?Zero or one{n}Exactly n times^Line start$Line end\bWord boundaryPractical Examples
Email Validation
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}Matches common email address formats.
Phone Number (US Format)
\\(?([0-9]{3})\\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})Captures area code, exchange, and number with flexible separators.
URL Matching
https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)Matches HTTP/HTTPS URLs with optional www prefix and paths.
Strong Password Validation
^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d@$!%*?&]{8,}$At least 8 characters with uppercase, lowercase, and digits.
Advanced Features
([0-9]{4})-([0-9]{2})-([0-9]{2})(?=.*password)(?:http|https)://sed Command Generation
Generate equivalent sed commands from your regex and replacement text.
Search Mode (Empty Replacement)
When replacement is empty, output only matching lines.
sed -n '/pattern/p' input.txtReplace Mode (With Replacement)
When replacement text is provided, generate a replace command.
sed 's/pattern/replacement/flags' input.txt