GoWebTools

Regex Tester and Debugger

Test regular expressions against your text with live match highlighting, capture groups, flags and replacement preview. Free, runs in your browser.

Regular expression

//gm

Test text

Matches

Matches are highlighted here.

Replace

Use $1, $2 for capture groups and $<name> for named ones.

Quick reference

\d
any digit
\w
letter, digit or underscore
\s
whitespace
.
any character except newline
[abc]
one of a, b, c
[^abc]
anything but a, b, c
a*
zero or more
a+
one or more
a?
optional
a{2,4}
between two and four
(...)
capture group
(?:...)
group without capturing
(?<name>...)
named group
^ $
start and end
\b
word boundary
a|b
either a or b
(?=...)
followed by
(?!...)
not followed by

What this tool is for

Write a pattern, paste your text, and see every match highlighted as you type, with capture groups listed per match and a replacement preview underneath. The flags are explained rather than assumed, because half of regex confusion is not the pattern but whether the global or multiline flag is on.

How to use it

  1. Type the pattern. It compiles as you type, and a broken pattern tells you why instead of failing silently.
  2. Toggle the flags: hover each one to see what it changes.
  3. Paste your test text and read the highlights and the match table.
  4. Try a replacement with $1 and $2 to check the result before using it anywhere.

Frequently asked questions

Which regex flavour is this?

JavaScript, because it runs in your browser. It is close to PCRE for everyday patterns, but lookbehind, named groups and unicode property escapes differ from Python or PHP in details worth checking before you copy a pattern across languages.

Why does my pattern match nothing?

The three usual causes: the global flag is off so only the first match is found, the dot does not cross newlines unless the s flag is on, and ^ or $ anchor to the whole text rather than each line unless the m flag is on.

My pattern hangs the page.

That is catastrophic backtracking, usually from nested quantifiers like (a+)+ against a long non-matching string. Simplify the nesting or anchor the pattern. This tool caps the number of matches it collects, which limits the damage but cannot prevent it.