Demo: explain a slug regex visually
Regex railroad diagrams are useful for documentation and code review because they translate dense syntax into readable branches and repeats.
- Use the preview to explain validation rules to non-regex reviewers.
- Break long expressions into named examples when possible.
- Pair the diagram with matching and non-matching test cases.
^[a-z0-9]+(?:-[a-z0-9]+)*$