DevTools Hub

Search tools

Search for a developer tool

Development

Regex Visualizer

Break a regular expression down into a visual diagram of groups, alternatives and quantifiers.

//
Try an example:
Structure
^
Group "user"
[\w.+-]1+
@
Group "domain"
[\w-]1+
.
[\w.-]1+
$

Hover any piece for a plain-English description. Blue boxes are groups, amber boxes are alternatives, and violet badges show how many times the piece repeats.

Plain-English breakdown
  • Start of the string (or line, with the m flag)
  • Named group "user" (group 1):
  • Repeat one or more times:
  • Any character in \w.+-
  • The literal text "@"
  • Named group "domain" (group 2):
  • Repeat one or more times:
  • Any character in \w-
  • The literal text "."
  • Repeat one or more times:
  • Any character in \w.-
  • End of the string (or line, with the m flag)

Seeing the structure of a pattern

Reading someone else's regular expression is a different skill from writing your own — you're parsing a dense string of punctuation back into the structure it represents. This tool does that parsing for you: paste a pattern and it's broken down into nested boxes for groups and alternatives, with a badge on anything that repeats, plus a plain-English line-by-line breakdown underneath. Hover any piece of the diagram for its description.

It runs entirely client-side against a small hand-written parser covering the constructs you'll meet in practice — literals, character classes, anchors, quantifiers, groups (capturing, non-capturing, named, and lookaround), alternation, and backreferences.

Reading the diagram

FAQ

Why does my pattern show an error here but seems to work elsewhere?

This tool validates with the same RegExp engine your browser uses, so a pattern that's invalid here is invalid in JavaScript. If it worked in another language (PCRE, Python's re, POSIX), the syntax may differ slightly — JavaScript regex isn't 100% identical to every other flavor.

Does this tool test my pattern against text?

No — it only visualizes structure. To test a pattern against sample text with match highlighting, use the Regex Tester. To build a pattern from scratch by clicking pieces together instead of writing it by hand, use the Regex Builder.

New to regex syntax entirely?

The Regex for Beginners guide walks through the same building blocks this tool visualizes — character classes, anchors, quantifiers, and groups — from scratch. Want a token reference to keep handy while you work? The Regex Cheat Sheet Generator exports a customizable syntax reference as Markdown or plain text.

Related tools