Regex Tester
Test and debug regular expressions with live match highlighting, match list, and capture group details. All client-side.
Common Patterns
Frequently Asked Questions
gβ Global: find all matches, not just the first.iβ Case-insensitive:Amatchesa.mβ Multiline:^and$match start/end of each line.sβ DotAll:.matches newline characters too.
How the Regex Tester Works
Testing a regex is a three-step pipeline from pattern compilation to highlighted results.
Compile Pattern
The pattern string and flags are passed to new RegExp(pattern, flags). Any syntax error (unclosed group, invalid escape sequence, etc.) is caught immediately and shown as a readable error message.
Find All Matches
String.matchAll(regex) returns an iterator of all matches including their index position, full match string, and all named/numbered capture groups β even for zero-length assertions.
Highlight & Tabulate
Each match is wrapped in a color-coded <mark> in the test string view. The match table shows every match's index, full text, and capture groups for detailed inspection.
Common Use Cases
Input Validation Patterns
Test email, phone number, postal code, IP address, and URL validation regexes against real-world edge cases before embedding them in server-side or client-side validation code.
Log File Parsing
Extract timestamps, IP addresses, HTTP methods, status codes, and user agents from Apache/Nginx access logs or application logs using capture groups. Test the pattern against sample lines before running it at scale.
Text Extraction
Pull structured data (prices, dates, order numbers, citations) from unstructured text. The match table shows exactly what each capture group extracted, making complex multi-group patterns easy to debug.
Search and Replace
Build the match half of a String.replace() or sed substitution. See exactly what will be replaced before applying the pattern to real data or a production script.
Security Rule Patterns
WAF rules, router constraints, and middleware filters use regex to allow/deny paths and parameters. Test the pattern against both valid and malicious inputs to ensure it allows the right things and blocks the rest.
Learning Regex Syntax
The Common Patterns library shows ready-made regexes for email, URL, IP, date, UUID, and more. Use them as starting points, modify them, and observe how each change affects the match results in real time.