Skip to content
FestivKit

Regex Tester

Try a pattern with JavaScript RegExp flags, highlight matches, and inspect groups. This is not a PCRE engine.

Your data stays in your browser. This tool processes your input locally and does not upload it to a server.

This uses JavaScript RegExp. It is not PCRE, and features such as recursion are unavailable.

Test string

Pattern library

Email

A practical email shape. It is not a full RFC parser.

URL

HTTP or HTTPS URLs up to the next space.

Hex color

3 or 6 digit hex colors.

IPv4

Four dotted numbers. It does not limit each octet to 255.

Slug

A whole-string lowercase slug.

ISO date

Dates shaped like 2026-11-30.

What is a regex tester?

A regex tester lets you try a regular expression against sample text and see what it matches before you put it in code. This one uses your browser’s JavaScript RegExp engine, supports the g, i, m, s, u and y flags, highlights each match, and lists its index and capture groups.

How this regex tester works

Type a pattern, tick the flags you want, and paste your test string. The tool builds a RegExp object, runs it in a background worker, and shows every match with its position (index) and the text captured by each group. Matches are highlighted in the test string. Unmatched optional groups appear as empty values.

If the pattern is invalid, you see the browser’s own error message. The worker is stopped after about a second, so a pattern prone to catastrophic backtracking will not freeze the page. Results are capped at 1,000 matches.

JavaScript flavor, not PCRE

The engine is JavaScript’s, which is what runs in browsers and Node.js. It supports lookahead, lookbehind, named groups and Unicode property escapes (with the u flag). It does not support PCRE extras such as recursion, possessive quantifiers or atomic groups.

If you write patterns for Python, PHP or grep, test the basics here but verify them in the target language, because syntax and defaults differ.

Privacy

The pattern and text are processed locally in your browser. Nothing is uploaded, so it is safe to test against log lines or sample data.

Examples

Extract ISO dates with capture groups

Input

Pattern: (\d{4})-(\d{2})-(\d{2})
Flags: g
Text: Due 2026-12-01 or 2027-01-15

Output

2 matches
2026-12-01 at index 4, groups #1 2026, #2 12, #3 01
2027-01-15 at index 18, groups #1 2027, #2 01, #3 15

Case-insensitive word match

Input

Pattern: cat
Flags: g, i
Text: Cat cat CAT

Output

3 matches at indexes 0, 4 and 8

Without the i flag, only the lowercase "cat" at index 4 matches.

Invalid pattern

Input

Pattern: (abc

Output

An error message from the JavaScript engine about an unterminated group

The exact wording depends on your browser.

Common mistakes and edge cases

  • Without the g flag, only the first match is reported. Turn on Global to list every match.
  • The ^ and $ anchors match the whole string unless you enable Multiline (m), in which case they match at each line.
  • The dot does not match newline characters unless you enable the s flag.
  • Escape special characters such as . ? + * ( ) [ ] { } | \ when you mean them literally. In a JavaScript string you also need to double the backslash, so \d becomes "\\d" in code.
  • Nested quantifiers such as (a+)+ can backtrack catastrophically on long non-matching input. If the tool reports a timeout, simplify the pattern.
  • The built-in email and IPv4 patterns are practical shapes, not validators. The IPv4 example does not limit octets to 255.

How to use this tool

  1. Enter a pattern and choose flags.
  2. Paste the text to test.
  3. Review matches, indexes, and capture groups. Load a common pattern if you want a starting point.

Frequently asked questions

Which regex engine does this tester use?

It uses the JavaScript RegExp engine built into your browser, the same one used by Node.js and front-end code. It is not PCRE, so features like recursion and possessive quantifiers are unavailable, and some syntax differs from Python, PHP or Java regex.

What do the regex flags g, i, m, s, u and y do?

g finds all matches instead of the first. i ignores case. m makes ^ and $ match at line boundaries. s lets the dot match newlines. u enables full Unicode handling and stricter syntax. y (sticky) matches only at the current position, so it is rarely needed for plain testing.

Why does my regex work here but not in my code?

Common causes are a missing or different flag, an unescaped backslash in a string literal, or a different regex flavor in your language. Check that the flags match, double the backslashes in string literals, and confirm the target language supports every feature you used.

Can I see capture groups and match positions?

Yes. Each match shows its value, its starting index in the text, and the contents of every numbered capture group. Groups that did not take part in the match show as empty. Named groups are numbered like other groups in this view.

What happens if my pattern is too slow?

The tester runs the pattern in a Web Worker and stops it after about a second, then asks you to simplify the pattern or shorten the text. This protects your browser from catastrophic backtracking caused by patterns like nested repeating groups.

References

Last reviewed

Related tools

Browse all tools