Regex Tester
Test JavaScript regular expressions instantly with browser-side execution, optional flags, match listings, and captured group inspection. Perfect for debugging patterns, validating search rules, and teaching regex behavior safely.
Supported JavaScript flags like g, i, m, s, u, and y.
Complete Guide: Regex Tester
Everything you need to know about using this tool effectively
The Regex Tester lets you write a regular expression and test it against sample text in real time. It highlights all matches in the input text, shows match details including capture groups, and lets you toggle flags (g, i, m, s) to change matching behavior. The tool helps you debug regex patterns by showing exactly what matches and what does not. All processing happens in the browser.
This tool constructs a JavaScript RegExp from your pattern and flags, runs it against the test string using matchAll, and displays every match with its index, full match text, and captured groups. Invalid regex patterns trigger a descriptive error message.
Debugging a regex pattern
Write a regex and test it against sample strings to verify it matches the intended text.
Extracting capture groups
Test a regex with parentheses to see what each group captures for use in code.
Learning regular expressions
Experiment with regex syntax and see immediate feedback on what matches.
Validating input patterns
Test a regex for validating emails, phone numbers, or URLs against real examples.
Enter your regex
Type the pattern in the regex input field (without delimiters).
Enter test text
Paste the text you want to match against.
Set flags
Toggle global (g), case-insensitive (i), multiline (m), or dotAll (s) flags.
Review matches
See highlighted matches, match count, and capture groups.
Use the global flag (g) to find all matches, not just the first one.
Capture groups are numbered from left to right starting at 1.
Test with edge cases like empty strings and special characters.
The preset patterns provide starting points for common use cases.
How do I enter a regex pattern?
Type the pattern without delimiters. For example, enter \d+ to match digits, not /\d+/. The flags are toggled separately.
What do the flags mean?
g (global) finds all matches. i (case-insensitive) ignores case. m (multiline) makes ^ and $ match line boundaries. s (dotAll) makes . match newlines.
What are capture groups?
Capture groups are parts of the pattern wrapped in parentheses. Each group captures the matched text so you can extract specific portions.
Is my input sent to a server?
No. All regex execution happens in your browser using JavaScript. Nothing is transmitted.
What if my regex is invalid?
The tool shows a descriptive error message from the JavaScript regex engine explaining what is wrong with the pattern.