How to use Regex Tester
- Enter a JavaScript regex pattern without leading or trailing slash delimiters, then choose flags.
- Paste the text to search and select Test pattern. Try the example for a case-insensitive match with a capturing group.
- Review highlighted matches and the JSON details, including starting positions and groups.
A closer look
Regular expressions describe text patterns. A pattern such as (cat) with gi flags finds every occurrence of cat regardless of case and records a capturing group. This tester uses the browser’s JavaScript RegExp engine, so syntax can differ from PCRE, Python, or other engines. Positions count UTF-16 code units starting at zero. Empty matches are shown with a visible marker, and Unicode-aware advancement prevents zero-length loops. A separate worker is terminated if testing takes longer than one second, keeping the interface responsive.
A practical example
Use the pattern cat with the global flag against cat, catalog, dog to find two matches. Add boundaries when you intend to match whole words only.
A useful tip
The g flag finds all matches. Without g or y, only the first match is returned. Sticky y matches only at the current position, so it can stop before a later occurrence that an ordinary global search would find.
Good questions. Simple answers.
Why was my pattern stopped?
Some nested repetitions can take a very long time on particular text. Simplify the pattern, use more specific boundaries, or reduce the input. A timeout is not a claim that the syntax is invalid.
Are results limited?
Yes. The tool accepts 1,000 pattern characters, 100,000 text characters, and shows at most 1,000 matches. A capped result is marked with a plus sign.
Explore all developer tools for related tasks and category-specific guidance, or read how Toolzafi handles your data.