Regex Tester

Test regular expressions live. See matches and capture groups.

Test regular expressions live, with every match explained

Regular expressions fail quietly: a pattern that looks right matches nothing, or matches far more than you intended, and you only find out in production. This free regex tester gives you a tight feedback loop — type a pattern, paste a test string, and see every match highlighted in place the moment either one changes. A results table below lists each match with its capture groups (named and numbered) and its exact character positions, so you can confirm not just that the pattern matches but that it captures precisely the parts you need.

The tester uses the JavaScript regex engine running in your browser, which makes it the accurate choice when your pattern will ultimately live in JavaScript or TypeScript — the same syntax, the same flag behavior, the same quirks. All six standard flags are available as checkboxes: g (global), i (ignore case), m (multiline), s (dotall), u (unicode), and y (sticky). Invalid patterns surface the engine’s actual error message rather than failing silently.

Nothing you test is sent anywhere, so it is fine to debug patterns against real log lines or user data. Use it to prototype validation rules, dial in a capture group for an extraction script, or figure out why that email regex keeps rejecting perfectly good addresses.

How to test a regex

  1. Enter your pattern

    Type the regular expression into the Pattern field without surrounding slashes, for example \d{4}-\d{2}-\d{2}. Syntax errors are reported immediately.

  2. Set the flags

    Toggle the g, i, m, s, u, and y checkboxes. Global (g) and ignore case (i) are on by default; turn g off to find only the first match.

  3. Paste a test string

    Add realistic sample text to the Test string box. Every match is highlighted inline and a match count updates live.

  4. Inspect matches and groups

    The results table shows each match, its named and numbered capture groups, and its start-end position in the string, so you can verify the captures are exactly what you expect.

Frequently asked questions

Which regex flavor does this tester use?

It runs the JavaScript (ECMAScript) regex engine in your browser. Behavior matches what you get in JavaScript and TypeScript code; engines like PCRE, Python re, or Java differ in some syntax such as lookbehind support and named group style.

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

g finds all matches instead of just the first, i ignores case, m makes ^ and $ match at line breaks, s lets the dot match newlines, u enables full Unicode handling, and y anchors each match to start exactly where the previous one ended.

What is a capture group in a regex?

Parentheses in a pattern capture the text they match so you can extract or reference it. Groups are numbered from 1 in order of opening parenthesis, and named groups use the (?<name>...) syntax. This tester lists both kinds for every match.

Why does my regex match nothing?

Common causes are unescaped special characters (a dot matches any character unless written as a backslash dot), case mismatches with the i flag off, anchors like ^ or $ that do not align with your input, and double-escaped backslashes copied from source code.

Is it safe to paste real production data here?

Yes. The pattern and test string are evaluated locally in your browser and are never transmitted to a server.

Pattern matching for your URLs?

ReSlug supports regex-style aliases and dynamic routing on Pro plans.

Create a free account