Skip to main content

Using regular expressions in PlantUML

· 2 min read

I recently discovered that PlantUML supports regular expressions, so I decided to try it out.

For this example, I'm visualizing the following branch naming rules:

Example of Usage

Here's how you would write the PlantUML regex in MDX:

@startregex
^((feature|bugfix|hotfix)\/\p{issue_id}-\p{summary}-\p{date(yyyymmdd)}|revert\/\p{commit_hash})$
@endregex

Rendered visually, it looks like this:

PlantUML diagram

This visualization makes the regex structure easy to understand and facilitates communication within the team.

Other Useful Applications

PlantUML can also easily create mind maps:

PlantUML diagram

Being text-based, it allows easy diff checking and is highly suitable for version control.

Comparison with Excel Shapes

In Japan, it is common to use Excel shapes for design documents, but they have several issues:

  • Text within shapes cannot be searched
  • Requires opening Excel to view documents
  • Difficult to manage with Git

Therefore, adopting text-based tools like PlantUML or Mermaid for design management is recommended.

extra

Docusaurus is the reason why the sidebar title is still in Japanese when displayed in English.

Caused by

https://github.com/facebook/docusaurus/issues/8996

There is a workaround, but it's a hassle and I'll wait for it to be resolved.