Regex Tester

//g
Common patterns

Quick reference

\ddigit
\wword char
\swhitespace
.any char
+1 or more
*0 or more
?optional
[abc]char set
^line start
$line end

What Is a Regex Tester?

The Regex Tester lets you build and debug regular expressions with instant feedback. Type a pattern and choose the flags (global, ignore-case, multiline, dotall), paste your test text, and every match is highlighted live as you type, with a running match count. It also lists numbered and named capture groups from the first match and includes a library of ready-made patterns — email, CPF, CEP, Brazilian phone, URL, IPv4 and dates — plus a quick reference of the most common syntax tokens. Everything uses your browser’s native JavaScript regex engine and runs locally, so your patterns and text stay private.

A regular expression (regex) is a sequence of characters that defines a search pattern. Regex testers let you write an expression and immediately see which parts of a text it matches, making it far easier to build and debug patterns before embedding them in code. Without an interactive tester, you must edit a script, run it, read output and repeat — a loop that a regex tester collapses into milliseconds.

Why your pattern doesn't match

A regex that returns nothing is rarely broken syntax — it is usually one of these behaviours doing exactly what it was told.

Greedy quantifiers swallowing too much

Against <b>one</b> and <b>two</b>, the pattern <.+> matches the whole line, not the first tag: + takes as much as it can and only gives back what it must. Add a question mark to make it lazy — <.+?> — and it stops at the first closing bracket.

An unescaped dot (or plus, or parenthesis)

A dot means "any character", so 3.14 also matches 3x14 and 3914. To match a literal dot, escape it: 3\.14. The same applies to + * ? ( ) [ ] { } ^ $ | and the backslash itself — inside a character class most of them lose their meaning, which is why [.] works too.

^ and $ anchored to the whole string

By default ^ means start of input and $ means end of input, so a pattern like ^error will only ever match if the very first line begins with it. Turn on the m flag and both anchors switch to start and end of each line, which is what you almost always want with log files.

\d and \w matching more than you expect

Without the u flag JavaScript's \w is strictly [A-Za-z0-9_], so it will not match an accented letter — a pattern built for names silently skips "José". Conversely, once you enable Unicode property escapes, \p{L} matches letters from every script, which may be more than a validator should accept.

Quantifiers at a glance

The difference between these four is where most unexpected match lengths come from. Assume the subject text is aaa.

PatternMeaningMatches in "aaa"Note
a+One or more, greedyaaaTakes everything it can
a+?One or more, lazyaStops at the first success
a*Zero or more, greedyaaaCan match nothing at all
a{2}Exactly twoaaFixed counts are never greedy
a{1,}Same as a+aaaRanges follow the same greedy rule

Adding ? after any quantifier makes it lazy. This is the fix for the classic <.+> problem: <.+?> stops at the first closing bracket instead of the last.

Testing a Regex

  1. Type a regular expression and toggle the flags (g, i, m, s) you need.
  2. Paste text below — matches are highlighted instantly with a count.
  3. Inspect the capture groups, or click a common pattern to start from a template.

Pattern Testing is Local

Regular expression testing is performed entirely in your browser using JavaScript's regex engine. The patterns and test strings you provide are processed locally on your machine — no data is sent to external servers.

FAQ

Which regex flavor is used?

It uses the JavaScript (ECMAScript) regular-expression engine in your browser, including named groups and the g, i, m and s flags.

Is my test text sent anywhere?

No. Matching runs entirely in your browser — nothing is uploaded.

Can I see capture groups?

Yes, both kinds. Numbered groups come from plain parentheses and are listed in order; named groups use the (?<year>\d{4}) syntax and are listed by name — which is what you want once a pattern has half a dozen captures and counting positions stops being practical.

What regex flags does this tool support?

The tool supports all standard JavaScript flags: g (global — find all matches, not just the first), i (case-insensitive), m (multiline — ^ and $ match start/end of each line), s (dotAll — dot matches newline), u (unicode) and d (generate match indices). Combine flags freely, e.g. gi for case-insensitive global search.