Back to Library
DevOps

Semantic Versioning

Matches SemVer 2.0.0 strings.

Pattern
^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$

Test Cases

1.0.0 Match
1.0.0-beta Match

Try it Live

Test and customize this pattern in our interactive editor

Open in Editor