1001Ferramentas
🧩Dev

Regex Visualizer

Paste a regex and see the token tree (literals, classes, groups, quantifiers) in ASCII — helps understand complex expressions. Everything in your browser.


  

Visualise a regex's structure

A complex regular expression, full of nested groups and quantifiers, is hard to read even for whoever wrote it. This tool opens the regex into an ASCII token tree and reveals the structure hiding behind that dense line of symbols.

The elements get separated out (literals, character classes, groups, quantifiers) and arranged in a hierarchy, making it clear what sits inside what and how the pieces fit together. It helps a lot when you inherit someone else's regex, need to debug a pattern that won't match, or just want to learn how more elaborate expressions work.

The analysis happens in your browser and nothing gets sent anywhere. Paste the expression, see the tree right away, and turn a cryptic line into something readable.

Frequently asked questions

Does the output really come out as a tree, with indentation?
No. What shows up is a flat list, one token per line, in the same order the symbols were written. A group turns into two separate lines, one saying it opens and another saying it closes, and the nesting is left for the reader to piece together. For a short regex that works fine; in a pattern three levels of brackets deep the list stays flat, and the hierarchy never gets drawn.
Should I paste the regex with the slash delimiters?
Better to leave them out. The field wants the bare pattern, no delimiters and no flags: pasting /^\d+$/g turns the opening slash, the closing slash and the g into literal characters, and the list gains three lines that belong to no part of the pattern. Type ^\d+$ instead. The page never tests the regex against sample text and never checks that the pattern compiles, so an unclosed bracket still yields a tidy-looking list.
Why did my escaped bracket show up as a capture group?
Because the token table knows only eight escapes: \d, \D, \w, \W, \s, \S, \b and the escaped dot. Any other escape gets broken in two: the backslash comes out alone as a literal and the next character gets read as if it stood by itself, which is why an escaped bracket reads as a capture group opening and an escaped plus reads as a quantifier. Lookbehind and named groups fall into that same generic bracket branch.

Related Tools