Regex Tester

Test regular expressions live with match highlighting, groups and a cheat sheet.

Test Regular Expressions with Live Match Highlighting

Regular expressions are dense, powerful and very easy to get subtly wrong. A pattern that looks correct often matches more than intended — or silently nothing at all — and the failure mode is usually invisible until real data hits it in production.

This tester runs your pattern against sample text as you type, highlighting every match and listing capture groups by index and name. Invalid patterns report the engine’s own error message rather than failing quietly, so you can see exactly which construct the parser rejected.

Key features

  • Live highlighting — every match marked in the test string as you type.
  • Capture groups listed — numbered and named groups shown per match, with their index in the string.
  • All six flags — global, case-insensitive, multiline, dotAll, unicode and sticky, as checkboxes or typed.
  • Real error messages — invalid syntax reports the engine’s explanation rather than silently failing.
  • Built-in cheat sheet — the constructs people look up most, always on screen.
  • Infinite-loop guard — zero-length matches cannot hang the page.
100% client-side — no data leaves your machine

This tool runs entirely inside your browser using native Web APIs. Your files and text are never uploaded to a server, never logged and never shared with third parties.

How to use: Regex Tester

  1. Enter your pattern
    Type it without the surrounding slashes — those are shown for you.
  2. Set your flags
    Use <code>g</code> to find every match rather than just the first, and <code>i</code> for case-insensitive matching.
  3. Paste representative test data
    Include the edge cases you expect to fail, not just the happy path — that is where patterns break.
  4. Check the group table
    Confirm each capture group is grabbing what you intend, and at the position you expect.

Technical specifications

Processing locationEntirely in your browser — no server round trip
Data uploadedNone. Files and text never leave your device
PriceFree — no account, no trial, no usage cap
CategoryDeveloper
Works offlineYes, once the page has loaded
Browser supportChrome 90+, Edge 90+, Firefox 90+, Safari 15+
Interface languagesEnglish, 中文, हिन्दी, Español, العربية

Frequently asked questions

Which regex flavour does this use?

JavaScript’s own engine (ECMAScript). It is very close to PCRE for everyday patterns, but lookbehind requires a modern browser, and possessive quantifiers and atomic groups are not supported at all.

Why does my pattern only find the first match?

Without the <code>g</code> flag, a regex stops at the first match. This tester lists all matches regardless so you can see the full picture, but your own code will only find one unless you set the flag.

What is the difference between greedy and lazy?

Greedy quantifiers like <code>.*</code> match as much as possible and then backtrack; lazy ones like <code>.*?</code> match as little as possible. Using greedy matching across HTML tags is the classic bug — <code>&lt;.*&gt;</code> swallows the entire line instead of one tag.

Should I use regex to parse HTML?

No. HTML is not a regular language, so no regex can parse it reliably — nesting and optional closing tags defeat every attempt. Use DOMParser in the browser or a real parser on the server. Regex is fine for extracting a simple pattern from text you control.

Related tools

Back to all tools