Regex Tester for JavaScript Regular Expressions
Test patterns against sample text, tune flags, inspect match indexes, and copy results with browser-side processing.
Try a common regex task
Regex safety note
JavaScript RegExp runs in a cancellable Web Worker. Each attempt has a 1.5-second timeout and returns at most 100 matches. Text is limited to 50,000 UTF-16 code units and patterns to 2,000; inputs are never silently truncated. Global matching is added when absent. Check edge cases before using a pattern in production.
No matches yet.
A regex tester runs a regular expression against sample text and shows matching results.
This page uses the browser JavaScript RegExp engine, so behavior follows JavaScript regex rules.
Use realistic sample text
Test against real-looking logs, URLs, IDs, or messages instead of only one idealized example.
Check edge cases
Include empty values, repeated matches, punctuation, line breaks, and mixed capitalization.
Example
Paste log text and test an email, ID, or URL pattern before moving it into code.
Assumption
Regex behavior follows browser JavaScript rules and supported flags.
Limitation
It does not emulate regex engines from Python, PCRE, Java, or databases.
Testing only one idealized sample
Add misses, edge cases, punctuation, line breaks, and mixed case before trusting the pattern.
Forgetting engine differences
This tester uses JavaScript RegExp. PCRE, Python, Java, database, and shell regex behavior can differ.
Creating expensive patterns
Nested quantifiers can cause catastrophic backtracking. This tester terminates attempts after 1.5 seconds; a timeout is not proof that the pattern has no matches. Simplify the pattern or shorten the sample.
Log parsing
Test patterns for timestamps, IDs, error codes, and repeated log lines.
Form validation
Check JavaScript patterns for emails, slugs, usernames, and simple inputs.
Capture groups
Check the number of capture groups; inspect their individual values in your target runtime.
Search cleanup
Find repeated words, delimiters, URLs, or structured snippets in pasted text.
Does it support flags?
Yes. Use JavaScript flags such as g, i, m, s, u, v, y, and d when supported by the browser.
Which regex engine does it use?
It uses the browser JavaScript RegExp engine. Regex engines vary, so results can differ from PCRE, Python, Java, database, or shell behavior.
Can it show capture groups?
When a match includes capture groups, the result notes the group count. It does not display individual captured values.
How is regex testing processed?
Patterns run in a local Web Worker, not on the page UI thread. An attempt times out after 1.5 seconds; the tester stops collecting at 100 matches and rejects oversized input rather than silently truncating it.
Suggested workflow
Pattern cleanup path
Clean sample text, test a JavaScript regex, and compare before-and-after results.