Logics Guru

Regex Tester

Test regular expressions with live match highlighting and capture groups.

Runs entirely in your browser. Your data never leaves this device and is never sent to our servers.
/ /
Matches 0

Quick reference

\dany digit
\wword character
\swhitespace
.any character
^start of string
$end of string
*0 or more
+1 or more
?0 or 1
{n,m}between n and m
[abc]any of a, b, c
(...)capture group
(?:...)non-capturing
\bword boundary
a|ba or b

A regular expression is easy to write and hard to verify by reading. This tester shows every match highlighted in your sample text, lists the capture groups, and updates as you type, so you can see what the pattern actually does rather than what you intended.

Patterns run in a Web Worker with a timeout, so a pattern that backtracks catastrophically stops the worker instead of freezing the page.

How to use it

  1. Type your pattern, without the surrounding slashes.
  2. Set flags — g for all matches, i for case-insensitive, m for multiline.
  3. Paste sample text and watch the matches highlight.
  4. Read the capture groups for each match.

Not working as you expect? Report a problem with this tool.

Frequently asked questions

What is catastrophic backtracking?
Some patterns, typically nested quantifiers like (a+)+, take exponential time on input that nearly matches. On a server that is a denial-of-service vector, which is why this runs in a worker with a timeout.
Which flavour of regex is this?
JavaScript, since it runs in your browser. PCRE used by PHP and Python is close but not identical — lookbehind and named group syntax differ in places.
Why does my pattern only find the first match?
You need the g flag. Without it the regex stops at the first match.