Skip to content
Accessibility
Theme
Text size
High contrast
Limit animations
Readable fontAtkinson Hyperlegible
Increased text spacing
Underline links
Always show focus

Runs in your browser — nothing you paste is uploaded.

Regex Tester

Test a JavaScript regular expression against sample text — live highlighting, match count and capture groups. Runs in your browser.


    

What it does

Enter a pattern and flags, then paste the text you want to match against. Every match is highlighted in place, counted, and listed below with its position and any capture groups. It runs on the browser's own JavaScript RegExp engine, so what you see here is exactly what pattern.exec() or String.match() would return in your code — no server round-trip, no dialect surprises.

Flags

  • g — global: find every match, not just the first. This tool always scans globally so the count and list are complete, even if you leave g out.
  • i — case-insensitive.
  • m — multiline: ^ and $ match at line breaks, not just string ends.
  • s — dotall: . also matches newlines.
  • u — unicode: correct handling of astral characters and \u{…} / \p{…} escapes.

Gotchas

  • Write the raw pattern, not a JS string literal. Type \d+ directly — don't double the backslash as you would inside a quoted string in code.
  • Zero-width matches (e.g. \b or a* that can match empty) are handled by nudging past empty hits, so they won't hang, but they can produce many empty matches — add something that consumes a character if that's not what you want.
  • Matching is capped at 20,000 results as a safety guard; a pattern that hits the cap on real text usually means it's too loose.
  • JavaScript lacks some features from other flavours (no possessive quantifiers; lookbehind needs a modern browser). Test here rather than assuming PCRE or Python behaviour.

Worked example

The pattern (\w+)@(\w+)\.(\w+) with flags gi matches a simple email and splits it into three capture groups. Run it over Mail bob@Example.com or ALICE@test.io and you'll get two matches, each listed with its index and groups like [bob, Example, com]. Use the group output to confirm you're capturing the right slices before copying the pattern into code.

Privacy

Matching happens locally; nothing you paste is uploaded.

Frequently asked questions

Which regex flavour does this use?

The browser's native JavaScript (ECMAScript) engine. That means the behaviour matches RegExp in your JS code exactly, but differs from PCRE, Python's re, or Go — features like possessive quantifiers aren't available, and some depend on your browser version.

Do I need to escape backslashes like in code?

No. Enter the pattern as-is: write \d+, not \\d+. The doubling is only needed when a regex is written inside a quoted JavaScript string; here you're typing the pattern directly.

Why do I see empty matches or a capped count?

Patterns that can match zero characters (such as \b or x*) produce zero-width matches; the tool steps past them so it won't loop forever. Results are also capped at 20,000, which usually signals an over-broad pattern rather than a limitation.

Related tools