Semantic Version Regex

Example:
^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$ Matches: ✓ 1.0.0 ✓ 2.5.13 ✗ 1.0 (missing patch)
Validate semantic versions (MAJOR.MINOR.PATCH): ^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$ (simplified)
Try Regex Lab →

FAQs

What about -beta or +build tags?

Full SemVer regex is much longer. This is the simplified MAJOR.MINOR.PATCH version.