# Regex Visualizer - Railroad Diagrams and Plain Explanations

> Visualize JavaScript regexes as railroad diagrams with a plain-language breakdown of groups, quantifiers, classes and lookarounds. Export SVG or PNG.

- URL: https://qilingtools.com/en/regex-visualizer
- Category: Developer Tools (https://qilingtools.com/en/dev)
- Tags: [Education](https://qilingtools.com/en/tags/education), [Charts & Visualization](https://qilingtools.com/en/tags/chart), [Developer](https://qilingtools.com/en/tags/dev), [Algorithms](https://qilingtools.com/en/tags/algorithm)
- Last updated: 2026-10-26
- Price: Free, no sign-up
- Privacy: Runs locally in the browser; files are never uploaded

Long regular expressions are hard to read at a glance. Paste one in — the /pattern/flags form works too — and a built-in parser reads it with JavaScript syntax and draws a railroad diagram: follow the line from left to right to see how matching proceeds, where forks mean one of several alternatives, a bypass above means optional, and an arrowed loop below means repetition, labeled with the count and whether it is lazy. Capturing groups, named groups and lookarounds are boxed and labeled, and character classes list every member. The explanation below translates each part into plain words, and hovering over the diagram or the explanation highlights the same span in your pattern. Supported syntax includes alternation, capturing, named and non-capturing groups, positive and negative lookahead and lookbehind, (?i:…) modifier groups, greedy and lazy quantifiers including {m,n}, character classes and escapes, the ^ $ \b \B anchors, back-references \1 and \k<name>, Unicode property escapes \p{…} and every flag d g i m s u v y — including v-mode nested classes with && and -- operators. Syntax errors point to the offending position, and diagrams export as SVG or high-resolution PNG for docs and code reviews.

## How to use

1. Enter a regex and tick its flags, or pick an example
2. Read the railroad diagram and the explanation, hovering any part to see it in the pattern
3. Export SVG or PNG, or open the regex tester to try it on real text

## Features

- Custom JavaScript regex parser covering ES2025 syntax
- Railroad diagram showing branches, optional parts, repeat counts and laziness
- Labeled boxes for groups, named groups, lookarounds and modifiers
- Plain-language explanation with two-way hover highlighting
- u and v flags, Unicode properties and class set operations
- Syntax errors with position
- SVG and PNG export

## FAQ

### How do I read a railroad diagram?

Start at the hollow circle on the left and follow the line to the filled circle on the right; each box you pass must match in turn. Where the line forks, any one branch can match. A line bypassing a box from above means that part is optional, and an arrowed loop below a box means it can repeat, labeled with the count (such as “2–5 times”) and whether it is lazy. Dashed boxes are zero-width assertions such as lookarounds; solid boxes are capturing groups.

### Which regex syntax is supported?

The parser follows JavaScript (ECMAScript 2025): alternation, capturing, named and non-capturing groups, all four lookarounds, (?i:…) modifier groups, every quantifier, character classes, \d \w \s escapes, \x \u \u{…} \c character escapes, anchors, back-references, \p{…} Unicode properties, and v-mode nested classes with &&, -- and \q{…}. Without the u flag it also follows the browser’s lenient rules for a lone {, or \8 beyond the group count, and tells you when it does.

### Why might Python or Java treat my regex differently?

Regex dialects differ. Python writes named groups as (?P<name>…) and supports \A and \Z, while Java and PCRE support possessive quantifiers like a++ and atomic groups (?>…), none of which exist in JavaScript. This tool parses strictly as JavaScript, and validity is checked with your browser’s own RegExp engine.

### Is my regex uploaded anywhere?

No. Parsing, drawing and exporting all happen in your browser; neither the pattern nor the images leave your computer.

## Related tools

- [JSON Formatter](https://qilingtools.com/en/json): Free online JSON formatter: beautify or minify, validate with the exact line and column of any error, browse a collapsible tree, sort keys and escape strings.
- [Base64 Encode/Decode](https://qilingtools.com/en/base64): Free online Base64 encoder and decoder: UTF-8 safe, optional URL-safe variant, convert text to Base64 and back in real time. Processed locally, never uploaded.
- [URL Encode/Decode](https://qilingtools.com/en/url-encode): Free online URL encoder and decoder with encodeURIComponent and encodeURI modes. Escapes Chinese, spaces and special characters. Real-time and local, no upload.
- [JWT Decoder](https://qilingtools.com/en/jwt): Free online JWT decoder: decode the header and payload of a JSON Web Token, show expiry and issued-at times, all locally without uploading the token.
- [Timestamp Converter](https://qilingtools.com/en/timestamp): Free online Unix timestamp converter: convert timestamps and dates, auto-detect seconds or milliseconds, and show local, UTC, ISO 8601 and relative time.
- [Hash / Checksum](https://qilingtools.com/en/hash): Free online hash calculator: SHA-1, SHA-256, SHA-384 and SHA-512 of text or any file through the browser crypto API. Files never leave your device.
- [UUID Generator](https://qilingtools.com/en/uuid): Free online UUID generator: create RFC 4122 UUID v4 in bulk with a cryptographic RNG. Options for uppercase, no hyphens and braces, with one-click copy.
- [Base Converter](https://qilingtools.com/en/base-convert): Free online number base converter: convert between binary, octal, decimal, hexadecimal and any base 2–36. Uses BigInt for huge integers, computed locally.
