Skip to content

Instantly share code, notes, and snippets.

@dennybaa
Forked from jhorsman/semver-regex.md
Last active April 4, 2019 13:21
Show Gist options
  • Save dennybaa/9c6bd721b659f2ae308aca7204aef089 to your computer and use it in GitHub Desktop.
Save dennybaa/9c6bd721b659f2ae308aca7204aef089 to your computer and use it in GitHub Desktop.
Semantic versioning regex #semver #regex

Semantic versioning regex

^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$

^([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$

example

http://regexr.com/3er1i

also see

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment