Regex Tester - Test Regular Expressions Online

Test and debug regular expressions online with live highlighting. Supports JavaScript regex with flags, capture groups, and match details.

/ /

About this calculator

Type a regular expression and some test text and see every match highlighted as you type. Choose flags such as g (all matches), i (ignore case) and m (multi-line).

It uses JavaScript regex syntax, so it matches what you get in the browser and in Node.js.

How to use it

  1. Enter the pattern and flags.
  2. Type or paste the test text.
  3. Press Test Regex and read the matches.

Regex building blocks

. any character; \d digit; \w letter, digit or underscore; \s whitespace; \b word boundary; * zero or more; + one or more; ? optional; {n,m} between n and m; ^ and $ start and end; (…) group; a|b either. Flags: g global, i ignore case, m multi-line, s dot matches newline.

Worked example

Pattern \b\w+ing\b with flags gi

TextThe running fox is jumping over the lazy dog
Matchesrunning, jumping

Tips and common mistakes

  • Start simple and add pieces one at a time.
  • Use \b to avoid matching inside longer words.
  • Greedy quantifiers match as much as possible; add ? to make them lazy.
  • Escape special characters like . and ? with a backslash.
  • Test with both matching and non-matching examples.

Frequently asked questions

What is a regular expression?

A pattern used to match text.

What does the g flag do?

Finds all matches, not just the first.

What is the difference between * and +?

* allows zero repeats, + needs at least one.

How do I match a literal dot?

Escape it: \.

What is a capture group?

Parentheses that capture part of a match for reuse.

Why does my regex match too much?

Quantifiers are greedy; make them lazy with ?.

Related tools