Regex Visualizer

Visualize regular expressions to help understand complex regex patterns.

Regular Expression

Test Match

Common Regex Cheatsheet

Email
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
Phone Number
^1[3-9]\d{9}$
URL
https?://[\w\-]+(\.[\w\-]+)+[\w\-.,@?^=%&:/~+#]*
IPv4
^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$
Date
^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$
Chinese Characters
[\u4e00-\u9fa5]+
ID Card Number
^\d{17}[\dXx]$
Hex Color
^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$

Usage Guide

Features

The regex visualization tool breaks down a regex expression into visual tokens, color-coded by type: character matching, character sets, anchors, groups, quantifiers, escapes, alternation, and dot. Each token shows its description and raw string. Also supports real-time matching with test strings, showing match positions and capture groups to help developers quickly understand complex regex.

Steps

Enter a regex string in the "Regular Expression" card (or click "Sample" or a preset below to auto-fill). Select match modifiers (g/i/m/s) on the right. The "Visual Parse" area displays each token; "Parse Description" gives an overall summary. Enter a test string in the "Test Match" card; all match results with their capture groups and index positions will be listed below.

Token Type Descriptions

Char (literal), Charset ([...]), Anchor (^/$/boundary), Group ((...)), Quantifier (*/+/{n,m}), Escape (\d/\w etc.), Alternation (

Notes

This tool uses a simplified parser and may not fully recognize deeply nested groups, backreferences, lookbehinds, and other advanced features. Parse results are for reference only; verification against the target language's official regex documentation is recommended. When an invalid regex is entered, a syntax error will be displayed; check that brackets, quantifiers, etc. are properly paired.