Regex Tester

Validate and test your regular expressions with live highlighting and match results.

Loading Smart Logic...

Quick Tip

Pick a common pattern or type your own — the slashes and flags are handled for you.

About This Tool

Why use Regex Tester?

Test a regular expression against sample text and see every match highlighted in place, with the match list, capture groups and character positions underneath. Results update as you type, and the g, i, m and s flags can be switched on and off individually.

The common patterns — email, URL, phone, date and hex colour — are there as starting points, since most regex work begins by adapting something that nearly fits. When a pattern finds nothing, the tool explains the likely reason: anchors that require a full-string match, case sensitivity, or ^ and $ needing the multiline flag to match at each line.

Key Benefits

Matches highlighted in context

Seeing what matched inside the original text is far quicker to debug than a list of strings alone.

Capture groups listed

Each group is shown per match, including groups that did not participate.

Explains an empty result

Instead of just "no matches", it points at the usual cause — anchors, case or the multiline flag.

How to use Regex Tester

  1. 1

    Pick a common pattern or type your own — the slashes and flags are handled for you.

  2. 2

    Toggle the flags you need: g for every match, i to ignore case, m for line anchors, s to let . match newlines.

  3. 3

    Paste your test text and watch the matches highlight as you type.

  4. 4

    Check the match list for capture groups and index positions.

Best use cases

Build a validation pattern for a form field.

Test a search-and-replace before running it across a codebase.

Extract values from log lines.

Learn regex syntax by watching matches change as you edit.

Regex Tester FAQs

Why does my pattern find no matches?

Most often the pattern is anchored with ^ and $, which require the whole text to match, or the case does not match and the i flag is off. With multi-line text, ^ and $ only match at the start and end unless the m flag is on.

What do the flags do?

g finds every match rather than the first, i ignores case, m makes ^ and $ match at each line break, and s lets the dot match newline characters.

Which regex flavour is this?

JavaScript's, which is what runs in browsers and Node. It is close to PCRE but differs in places — lookbehind support and some Unicode escapes vary between engines.

Can I use a regex to validate email addresses?

A simple pattern catches typos, but the full specification is far more permissive than most patterns allow. Validate loosely, then confirm the address by sending a message to it.

Related Developer Tools

More free developer tools that work well alongside regex tester.