Skip to content

Regex Tester

Build, test, and debug regular expressions with real-time matching.

/g
Matches (3)
user@example.com admin@company.org not-an-email hello@world.io

About the Regex Tester

Test and debug regular expressions against sample text with live highlighting. Every match is highlighted as you type and capture groups are broken out individually, so you can see exactly what your pattern grabs instead of discovering it in production.

How to use it

  1. 1 Enter your regular expression pattern in the pattern field.
  2. 2 Toggle flags such as g (global), i (case-insensitive), and m (multiline).
  3. 3 Paste sample text underneath — matches highlight immediately.
  4. 4 Inspect the numbered and named capture groups for each match.
  5. 5 Open the Explain tab to read what each part of the pattern actually does — useful when the regex is someone else's.

What it does

  • Live match highlighting as you type
  • Plain-English explanation of every token in the pattern
  • Full flag support: g, i, m, s, u, y — each one explained
  • Capture group and named group breakdown
  • Replacement preview with a library of common patterns
  • Clear error messages for invalid patterns

Frequently asked questions

Is my test text sent to a server?

No. Every calculation happens locally in your browser using JavaScript. Nothing you paste is uploaded, logged, or stored on a server, which makes the tool safe to use with production data, credentials, and customer records.

Which regex flavour does this use?

JavaScript (ECMAScript) regular expressions, evaluated by your browser's own engine. Most syntax is shared with PCRE, but some constructs differ — JavaScript has no lookbehind in older engines, no atomic groups, and no recursion. Patterns written for PHP, Python, or Java may need adjusting.

What does the g flag actually do?

Without g, a match attempt stops at the first hit. With g, the pattern keeps scanning and returns every match in the string. Be careful reusing a g-flagged RegExp object across calls — it keeps a lastIndex position between them, which is a classic source of bugs where every other call fails.

Why is my regex so slow or hanging the page?

You have probably hit catastrophic backtracking. Nested quantifiers like (a+)+ against a non-matching string force the engine to try an exponential number of paths. Fix it by making the inner quantifier possessive in spirit — restructure so each character can only be consumed one way, or anchor the pattern.

How do I match a literal dot or slash?

Escape it with a backslash: \. matches a literal period, and \/ matches a slash inside a literal regex. Unescaped, a dot means "any character except newline", which is why unescaped dots in domain or IP patterns match far more than intended.