atom regular expressions graphical display

Visualizing Regular Expressions Graphically with "regex-railroad-diagram" in Atom

Introducing the "regex-railroad-diagram" package, a tool for displaying and visualizing regular expressions as graphical railroad diagrams.

Shou Arisaka
2 min read
Oct 4, 2025

As a tool to understand and visualize regular expressions, you can use the “regex-railroad-diagram” package. This tool is an Atom editor package that displays regular expressions as graphical railroad diagrams. Regular expressions are useful for pattern matching and validation of text, but it can be difficult to intuitively understand complex regular expressions. regex-railroad-diagram is convenient in such cases.

Installing the Tool

To install the “regex-railroad-diagram” package, use the following command:

apm install regex-railroad-diagram

By installing this package, a tool that helps you visually understand regular expressions will be added to the Atom editor.

Usage Example

Using this package, you can display regular expressions in graphical format. This is particularly useful when regular expressions are complex or when sharing them with other developers. For example, consider the following regular expression:

^(?:(?:(?:0?[13578]|1[02])(\/|-|.)31)\1|(?:(?:0?[13-9]|1[0-2])(\/|-|.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:0?2(\/|-|.)29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$

This regular expression can be used for date validation and is very complex. Using “regex-railroad-diagram” makes this regular expression easier to understand visually.

Notes

In some cases, it may conflict with other Atom packages such as linter, which could cause problems when visualizing regular expressions. In that case, you can resolve the issue by temporarily disabling the linter.

Regular expressions are used for many purposes such as text processing and data extraction, but complex regular expressions can be difficult to understand and maintain. “regex-railroad-diagram” is one of the excellent tools to solve this problem, helping with the visualization of regular expressions.

References:

Share this article

Shou Arisaka Oct 4, 2025

🔗 Copy Links