Features
- Full JavaScript regex syntax support
- All standard flags (g, i, m, s, u, y)
- Match highlighting with positions
- Capture group extraction
- Match count and indexing
- Real-time error reporting
Use Cases
Pattern Development
Test and refine regex patterns before using them in production code
Data Validation
Validate input patterns like emails, phone numbers, and URLs
Text Extraction
Extract specific data patterns from unstructured text
Log Parsing
Build patterns to parse and extract information from log files
Regex Flags
Select flags by changing the action:| Flag | Name | Description |
|---|---|---|
g | Global | Find all matches (not just first) |
i | Ignore Case | Case-insensitive matching |
m | Multiline | ^ and $ match line boundaries |
s | DotAll | . matches newlines |
u | Unicode | Enable full Unicode support |
y | Sticky | Match from lastIndex position |
Common Flag Combinations
- Default:
gm(global, multiline) - Case-insensitive search:
gi - Single match:
i(no global flag) - Unicode text:
gu
Input Format
Pattern (Main Input)
Enter the regular expression pattern without delimiters:Do not include
/ delimiters. Enter only the pattern. Flags are set via the action parameter.Test String (Second Input)
The text to test against:Output Format
Matches are displayed with:- Match number - Sequential index
- Matched text - The captured string
- Position - Character offset in the input
- Capture groups - Named groups labeled as
g1,g2, etc.
Examples
- Phone Numbers
- Email Extraction
- Capture Groups
- Case-Insensitive
- Multiline Matching
Extract US phone numbers.Pattern:Test String:Output:
Implementation Details
Fromlib/tools/engine.ts:438-453:
Common Patterns
URL Matching
Hex Colors
IP Addresses
Date (YYYY-MM-DD)
HTML Tags
Credit Card (Simple)
Character Classes
| Pattern | Matches |
|---|---|
\d | Any digit (0-9) |
\D | Any non-digit |
\w | Word character (a-z, A-Z, 0-9, _) |
\W | Non-word character |
\s | Whitespace (space, tab, newline) |
\S | Non-whitespace |
. | Any character (except newline) |
[abc] | Any of a, b, or c |
[^abc] | Anything except a, b, or c |
[a-z] | Lowercase letters |
Quantifiers
| Pattern | Matches |
|---|---|
* | 0 or more |
+ | 1 or more |
? | 0 or 1 (optional) |
{n} | Exactly n times |
{n,} | n or more times |
{n,m} | Between n and m times |
Anchors
| Pattern | Matches |
|---|---|
^ | Start of string/line |
$ | End of string/line |
\b | Word boundary |
\B | Non-word boundary |
Common Mistakes
Greedy vs Non-Greedy
Case Sensitivity
By default, regex is case-sensitive. Use thei flag for case-insensitive matching:
Testing Strategy
- Start simple - Test basic patterns before adding complexity
- Test edge cases - Empty strings, special characters, very long inputs
- Use capture groups - Extract specific parts of matches
- Check performance - Avoid catastrophic backtracking with complex patterns
- Validate thoroughly - Test with both valid and invalid inputs
Related Tools
- String Inspector - Analyze text characteristics
- Text Separator - Split text with custom delimiters
- URL Parser - Parse URL components