Regex tester
Check matches, capture groups and replacement results of JavaScript regular expressions inside this browser.
How to use the regex tester
Use it to see where a pattern matches with this browser's JavaScript regular expression engine (RegExp), what the capture groups contain, and how a replacement changes the text.
- Enter a pattern and choose the flags you need.
- Paste a test string; the results refresh automatically right after you stop typing.
- Review the matches and highlight, then add a replacement string and copy the result.
Example: (?<year>\d{4})-(?<month>\d{2}) $<month>/$<year>
Limits
- The test string is limited to 200,000 characters (string length) and only the first 1,000 matches are shown.
- Matching runs in a separate worker thread (Web Worker) and is stopped with a timeout notice after 1.5 seconds.
- Without the g flag only the first match is found and only the first match is replaced.
- A pattern that matches an empty string advances one character at a time.
- Supported regular expression syntax can differ slightly between browsers. Results follow the browser you are using now.
Frequently asked questions
Is my input sent to a server?
No. Everything runs inside this browser, and your input is neither saved nor uploaded. It disappears when you reload.
What should I do when I see “Timed out”?
Nested repetition such as (a+)+$ can make the amount of work explode with only slightly longer input (catastrophic backtracking). Simplify the repetition or shorten the test string.
Is it the same as regular expressions in other languages?
No. This tool follows JavaScript syntax. Python, PCRE and others may support different features and escape rules.
What are $1 and $<name>?
In the replacement string, $1 becomes the value of the first capture group and $<name> becomes the value of the named capture group.