Test a JavaScript regular expression against sample text and inspect the matches.
How to test a pattern
- Enter the pattern without surrounding slash delimiters.
- Choose flags such as
gfor all matches orito ignore case. - Enter sample text and select Test Regex. Review the matched text, index and capture groups.
The default example finds two email-shaped strings. It demonstrates matching and is not a complete email address validator.
Reading the results
Indexes start at zero and count UTF-16 code units, as JavaScript does. An emoji can occupy two units. Quoted output escapes line breaks so individual matches remain readable. Without g, only the first match is returned. Empty patterns and other zero-width matches are supported.
Regex flavor
This tester uses the JavaScript RegExp engine available in your browser. Other regex engines can support different syntax or features.
Test text is capped at 100,000 characters. Patterns are capped at 5,000 characters. Tests run in a separate worker and are stopped after about two seconds; Cancel stops a running test. Up to 500 matches are displayed. Timing depends on browser scheduling.
Supported flags depend on your browser. Invalid or repeated flags produce an error. The sticky y flag starts matching at index zero and does not search ahead; with g, subsequent matches must be contiguous. For syntax details, see MDN’s JavaScript RegExp reference.