Test a regular expression
Type a pattern and a sample. A pattern that runs too long is stopped.
RegexOn this device
The pattern is a JavaScript RegExp, the same engine this browser uses. Flags are the checkboxes. Matches are highlighted in the sample and listed underneath, up to 100. The work runs off the page thread and stops if it takes longer than a moment, so a catastrophic pattern does not freeze the tab.
How to use it
- Type the pattern without slashes.
- Turn on the flags you need. g lists every match.
- Paste the sample and read the list. Copy copies the list, not the whole sample.
Good to know
- Named groups appear as name=value when the engine returns them.
- The pattern is limited to 300 characters and the sample to 20,000.
- This is JavaScript syntax, not Python or PCRE. A lookbehind the browser rejects will say so.
Questions
Why did it stop?
The pattern was still running after a short limit. Shorten the sample or remove nested repetition.
Does g change the highlight?
Yes. Without g you get the first match only.