Regex Tester

Type a pattern, type a test string, see matches highlight in real time. All JavaScript regex flags supported — capture groups listed, position indices shown, no rate limits.

Why use a regex tester?

How it works

Your pattern and flags are passed to the JavaScript RegExp constructor — exactly the engine your code will run. The 'g' flag is force-added internally so we can find all matches (the displayed flags don't change). For each match, we record the full match string, its starting index, and any capture groups, then highlight the matches inline in the test string and list the first 50 with their positions. Invalid patterns surface the engine's own error message rather than silently failing.

Frequently asked questions

Which regex flavor is this?

JavaScript (ECMAScript) regex, via the browser's RegExp engine. Supports lookaheads, lookbehinds, named groups, Unicode property escapes, and the dotAll/sticky/unicode flags. Patterns from PCRE, Python, or Ruby usually work but won't always — possessive quantifiers and recursive patterns aren't supported.

What flags can I use?

The six standard flags: g (global), i (case-insensitive), m (multiline ^$ behavior), s (dotAll — . matches newlines), u (unicode), y (sticky). Type any combination into the flags field. We force g internally to find all matches; the displayed flags otherwise pass through unchanged.

Why are only 50 matches listed?

Display sanity. The match summary shows the first 50 entries with positions and capture groups; the highlighted preview always shows every match. The total count is shown above the list.

Can I see capture groups?

Yes — each match's capture groups are listed inline beneath it, in order. Named groups (?<name>…) work too; their values appear alongside the numbered ones.

Is my test string logged?

No. Pattern, flags, and test input live entirely in this page's JavaScript context. Safe to paste real log lines or sample data.

About this tool

Regular expressions are the most concentrated bit of code you'll write all day — a one-line pattern can match anything from a phone number to a multi-line config block. The cost of that concentration is fragility: a stray quantifier or a misplaced capture group changes the meaning entirely, and the failure modes are silent (a regex that matches too little or too much produces empty arrays, not errors). A good tester collapses the dev loop from 'write, run, scan output' down to 'type, see highlighted matches, adjust' — which is the difference between iterating in seconds and iterating in minutes.