What this tool does
Evaluates a JavaScript regular expression against text, showing match positions, numbered captures and named capture groups.
How to use it
- Enter the pattern without surrounding slash delimiters.
- Choose global, case-insensitive, multiline, dot-all or Unicode flags and provide test text.
- Run the test, inspect matches and groups, then revise or clear your inputs.
Worked example
Pattern (?<word>\w+) with flags gu against ‘Hello world’ returns Hello at indexes 0–5 and world at 6–11, each with a named word capture. End indexes are exclusive.
Processing and explanation
Matching uses the browser’s JavaScript RegExp engine in a separate module worker. The main tab terminates that worker after two seconds, including worker startup. Global zero-length matches advance the search position safely, respecting Unicode surrogate pairs when the Unicode flag is selected.
Limits and common mistakes
Pattern up to 2,000 and test text up to 100,000 UTF-16 code units; 200 displayed matches, 12 numbered and 12 named groups. Match text clips at 2,000 characters and each group at 300. Slow patterns time out; browser support determines available JavaScript syntax. PCRE, Python, .NET syntax and replacement previews are unsupported.
Privacy and your input
Pattern matching runs in a local worker. Patterns, test strings and captures are not uploaded, stored or added to analytics. Editing an input cancels any running test; clearing or leaving the page terminates the worker.
Frequently asked questions
- Why do indexes differ from visible character counts?
- JavaScript match positions count UTF-16 code units, so an emoji can occupy two positions.
- Why does only one match appear?
- Enable the global flag to collect more than the first match.
- What happens to an expensive pattern?
- After two seconds the local worker is terminated. The page remains usable and a simpler pattern can be tested again.
Material content update: