> test | match | debug <
// Test and debug regular expressions with real-time matching
Live Matching
Matches update instantly as you type your regex pattern or test string. No button clicks needed.
Visual Results
Matched text is highlighted directly in your test string with colored backgrounds for easy identification.
Common Patterns Library
Quick-insert common regex patterns for emails, URLs, phone numbers, IP addresses, and dates.
// ABOUT REGULAR EXPRESSIONS
JavaScript RegExp:
Regular expressions (regex) are patterns used to match character combinations in strings. JavaScript supports flags: g (global), i (case-insensitive), m (multiline), s (dotAll), and u (unicode). Patterns can include character classes, quantifiers, anchors, groups, and lookahead/lookbehind assertions.
Example:
/\d+/g matches "abc123def456" → ["123", "456"]
Common Use Cases:
- >Form validation: email, phone, URL patterns
- >Text search and replace with pattern matching
- >Data extraction and web scraping
- >Log file analysis and parsing
- >Input sanitization and filtering
>> frequently asked questions
Q: What is a regular expression (regex)?
A: A regular expression is a sequence of characters that defines a search pattern. It can be used for string matching, searching, and replacing. For example, \d+ matches one or more digits, and [a-z]+ matches one or more lowercase letters.
Q: What do the regex flags mean?
A: g (global) finds all matches instead of stopping at the first. i (case-insensitive) ignores case. m (multiline) makes ^ and $ match line starts/ends. s (dotAll) makes . match newlines. u (unicode) enables full Unicode support.
Q: What are capture groups?
A: Capture groups are created with parentheses () in a regex pattern. They capture the matched text so you can reference it later. For example, (\d{4})-(\d{2})-(\d{2}) captures year, month, and day separately from a date string.
Q: What is the difference between greedy and lazy matching?
A: Greedy quantifiers (*, +, {n,}) match as much text as possible, while lazy quantifiers (*?, +?, {n,}?) match as little as possible. For example, in "<b>bold</b>", the pattern <.*> (greedy) matches the entire string, while <.*?> (lazy) matches only <b>.
Q: What are some commonly used regex patterns?
A: Common patterns include: Email: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,} | URL: https?://[^\s]+ | IP Address: \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b | Date: \d{4}-\d{2}-\d{2}