How to use
- Type a regular expression in the Pattern box, without the surrounding slashes.
- Choose flags with the checkboxes, for example g to find every match or i to ignore case.
- Paste the text to test. Matches are highlighted and listed with their position and capture groups.
JavaScript regular expressions
This tool uses the regular expression engine of your own browser, so results match what JavaScript code (browsers and Node.js) will do. Other languages differ: PCRE, Python, Java and .NET support features such as possessive quantifiers, atomic groups and inline flags that JavaScript does not.
Supported flags: g (all matches), i (ignore case), m (^ and $ match at line breaks), s (. matches line breaks), u (full Unicode mode) and y (sticky). Without g, only the first match is shown, exactly like String.prototype.match.
Matches and capture groups
Each match lists its start index (counted in UTF-16 code units, as JavaScript does), its text, every numbered capture group and every named group. A group that did not take part in the match is shown as undefined. Empty matches are listed too, and with the u flag the scan steps over whole characters such as emoji.
At most 1,000 matches are collected. If there are more, the tool says so. The pattern is limited to 10,000 characters and the text to 1,000,000 characters.
Catastrophic backtracking is stopped
Some patterns, such as (a+)+$ against a long run of a's followed by another character, take exponential time. A page that runs them directly freezes. This tool runs your pattern in a separate background worker and stops it after 2 seconds, then tells you the pattern is too slow, so the page always stays usable.
If your browser cannot start a worker, the tool shows an error rather than running the pattern on the page itself.
FAQ
- Is my text or pattern uploaded?
- No. The pattern and text are processed by a worker in your browser. They are not sent to a server, not stored, and not added to the page URL.
- Why do results differ from regex101 or my Python code?
- Regex engines differ between languages. This tool runs JavaScript regular expressions, so it matches JavaScript behaviour only.
- Why does my pattern report an error?
- The message comes from the browser's own regex engine, for example an unterminated group or an invalid escape. With the u flag, escapes are stricter than without it.