Free Developer Tool

Regex Tester & Debugger

Build and debug regular expressions with live match highlighting, capture-group inspection, find-and-replace, flags, and an instant cheat sheet.

Pattern & Test Text

//g

Matches

3 matches

Regex Cheat Sheet

\dAny digit (0–9)
\wWord character (a–z, 0–9, _)
\sWhitespace (space, tab, newline)
.Any character except newline
*0 or more of the previous
+1 or more of the previous
?0 or 1 of the previous (optional)
{n,m}Between n and m repetitions
^Start of string / line (with m)
$End of string / line (with m)
[abc]Any of a, b, c
[^abc]Anything except a, b, c
( )Capture group — referenced as $1, $2…
(?: )Non-capturing group
a|ba or b
\bWord boundary
$&In replacement: the whole match
$1In replacement: capture group 1

Anchor Your Intent

  • • Use ^ and $ only when the whole line must match — email validators need them, search-and-extract patterns don't.
  • • Prefer \b word boundaries over spaces when matching standalone words like "cat" without catching "concatenate".
  • • With the m flag, ^ and $ apply per line — without it they apply to the entire string.

Greedy vs Lazy

  • • Quantifiers (*, +, {n,m}) are greedy by default and consume as much as they can — append ? to make them lazy.
  • • For quoted text, "([^"]*)" beats "(.+?)" — it can't overrun the closing quote and it fails fast.
  • • When performance matters, prefer specific classes (\d, [^,]) over . — they backtrack far less.

Replacement Power

  • • Reference capture groups with $1, $2 — reformat dates, swap name order, wrap matches in tags.
  • • $& inserts the whole match without needing any group: wrap emails in links with <a href="mailto:$&">$&</a>.
  • • Use $` and $' for text before/after the match, and $$ for a literal dollar sign.

How to Use the Regex Tester

  1. Type your pattern

    Enter the regular expression body (without slashes). Invalid patterns show the exact JavaScript error instantly.

  2. Pick flags

    Toggle g for all matches, i for case-insensitive, m for multiline ^ and $ behavior.

  3. Paste test text

    Matches highlight in amber as you type, with a full list of matches, indexes and capture groups below.

  4. Try a replacement

    Add a replacement string with $1/$& tokens to preview find-and-replace before using it in code.

Uses your browser's JavaScript RegExp engine — the same engine your web code runs, so results transfer 1:1 to production.

Knowledge Base

Frequently Asked Questions

Data Handling Toolkit

Extracted data? Format it as JSON.

Once your regex has pulled values from logs or text, validate and pretty-print the result before feeding it to an API.

Try the JSON Formatter

Related tools

Need a custom tool?

We build calculators and internal tools for businesses — get in touch.

Directory last updated 2 December 2026.

Disclaimer: This tester uses JavaScript (ECMAScript) regex syntax. Flavors like PCRE (PHP), Python re, and .NET differ in details — always re-test patterns in the target language before shipping to production.