Ads Leaderboard

Regex Tester

Write a regular expression, paste your text and see every match with its position and capture groups. Invalid patterns are reported safely instead of breaking the page.

Flags
Runs entirely in your browser · Ctrl+Enter to run
Ads In-Content

How to use Regex Tester

  1. Enter your pattern — JavaScript (ECMAScript) regex syntax is supported.
  2. Toggle the flags with the buttons (g is added automatically so all matches are listed).
  3. Paste the text you want to search and click Find matches.
  4. Read the match count, positions and capture groups in the results list.

Features

  • Match count, index positions and match text
  • Numbered and named capture groups for every match
  • Flag toggles: d, g, i, m, s, u, v, y
  • Invalid regex and invalid flags produce a clear error, never a crash
  • Results capped at 1,000 matches so huge inputs stay responsive
  • Ctrl+Enter runs the test — everything stays in your browser

Important information

This tool runs JavaScript regular expressions exactly as your browser's engine would — the same syntax used with .match(), .replace() and RegExp in web code. Patterns from PCRE (PHP) or Python may differ: lookbehind, named groups and Unicode classes are supported by modern engines, but constructs like recursive patterns are not. A pathological pattern (for example nested quantifiers like (a+)+) can take a very long time on large inputs — the regex runs synchronously on the main thread, so keep test text modest when experimenting.

Frequently asked questions

Why are only the first matches shown?

Listing every match requires the g (global) flag — the tool adds it automatically and tells you when it did. Without it, JavaScript's regex engine stops after the first match.

What do 'index' and 'group' mean?

Index is the zero-based position where the match starts in your text. Groups are the parts of the pattern inside parentheses, numbered by their opening bracket; named groups (?<name>…) are listed with their names too.

Does my text get uploaded?

No. The regex runs locally in this tab; nothing is sent to a server.