Skip to content
SmaftyTools

Regex Tester

Test regular expressions against sample text with live match highlighting, flags and capture groups. Free online regex tester.

About Regex Tester

The Regex Tester is a free regex tester and pattern test tool for building and debugging regular expressions against real sample text, with every match highlighted live as you type. Type a pattern, choose your flags (global, case-insensitive, multiline and more), and see instantly which parts of your text match, along with each capture group broken out separately.

Regular expressions are one of the most powerful — and most commonly misused — tools in a developer's kit. A pattern that looks right can silently match too much, too little, or nothing at all, and debugging that by adding console.log statements inside application code is slow. Testing interactively instead shows you exactly what a regular expression matches in real sample text: log lines you're trying to parse, form input you're trying to validate, a CSV column you're trying to extract, or a URL you're trying to route. It also makes learning regex faster: instead of memorizing what a lookahead or a non-capturing group does in the abstract, you can change one token at a time and watch the highlighted matches update immediately, building intuition through direct feedback rather than documentation alone.

The tester runs on JavaScript's native RegExp engine — the exact same engine used by Node.js and every modern browser — so results here are guaranteed to match what your code will actually do, unlike testers built on a different regex flavor (PCRE, .NET, Python re) that can behave subtly differently around lookbehind, named groups or Unicode property escapes. Invalid patterns surface the browser's own SyntaxError message, pointing at the real problem instead of a generic 'invalid regex'.

Everything runs client-side, so sample text — even if it contains real log data or user records — never leaves your browser.

How to Use the Regex Tester

  1. Enter your regular expression pattern in the pattern field.
  2. Select flags such as g (global), i (ignore case) or m (multiline).
  3. Paste sample text in the test area — matches highlight instantly.
  4. Inspect the match list and capture groups, then refine the pattern.

Features

  • Live match highlighting as you type
  • Full flag support: g, i, m, s, u, y
  • Capture group inspection for each match
  • Native JavaScript RegExp engine — results match your code

Examples

Extracting email addresses from text

Validating a phone number format

Input

555-123-4567  (pattern: ^\d{3}-\d{3}-\d{4}$)

Output

Match: full string matches (1 match, 0 capture groups)

Capturing groups from a log line

Input

2024-01-15 ERROR Connection timeout

Output

Match found — Group 1: 2024-01-15, Group 2: ERROR, Group 3: Connection timeout

Frequently Asked Questions

Which regex syntax does this tester use?

JavaScript (ECMAScript) regular expressions — the same engine as Node.js and all browsers. Most patterns are portable, but some features differ from PCRE (Python/PHP), such as lookbehind support and named group syntax.

Why does my pattern match too much?

Usually greedy quantifiers. * and + match as much as possible; add ? (e.g. .*?) to make them lazy, or use a more specific character class instead of the dot.

Can I use this as a pattern test tool before adding validation to a form?

Yes — paste example valid and invalid values into the test area, anchor the pattern with ^ and $, and confirm it matches only the values you want before wiring it into your form validation code.

Is the Regex Tester free?

Yes, the Regex Tester is completely free with no usage limits. No signup, no account and no installation required.

Is my data safe?

Yes. All processing happens locally in your browser using JavaScript — nothing you type is uploaded or stored on our servers.