Regex Tester

Test JavaScript regular expressions against sample text and list every match with its position and capture groups.

Runs on your device

Result

Results appear here as you type.

What it does

Write a pattern, set flags, and see exactly what it matches. Results show the index of each match and its numbered groups, which makes off by one and greedy quantifier mistakes easy to spot.

How to use it

  1. Enter the pattern without surrounding slashes.
  2. Add flags such as i or m.
  3. Paste test text and read the match table.

Example

The example fills in realistic values and runs the tool. Select Try an example above to see it.

When it helps

  • Building validation patterns.
  • Extracting fields from log lines.
  • Learning regex syntax interactively.

Questions

Which regex flavour is used?

JavaScript (ECMAScript), as implemented by your browser. Lookbehind and named groups work in all current browsers.

Why is the g flag always applied?

So that every match is listed. It does not change what an individual match looks like.

Can a pattern freeze the page?

Patterns with catastrophic backtracking can be slow. Results are capped at 1,000 matches; if typing becomes sluggish, simplify nested quantifiers.

More developer tools

See all 25

People also use

Browse all 200 tools