Regex Tester

Test JavaScript regular expressions with highlighted matches, positions, and capturing groups in a time-limited worker.

✓ Free to use · Runs in your browser · No sign-up

Find matching text safely

Enter a pattern without surrounding /slashes/. Use g to find every match and i to ignore letter case. Testing happens in a separate worker and stops after one second if a pattern is too slow.

Your data is processed locally in your browser and is not uploaded to our servers.

Up to 1,000 characters. An empty pattern matches positions between characters.
Supported: g (all), i (ignore case), m (line anchors), s (dot includes newlines), u (Unicode), y (sticky).
Up to 100,000 characters. Results are capped at 1,000 matches.

How to use Regex Tester

  1. Enter a JavaScript regex pattern without leading or trailing slash delimiters, then choose flags.
  2. Paste the text to search and select Test pattern. Try the example for a case-insensitive match with a capturing group.
  3. 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.

A few more useful tools