Aptivi - Deprecated Manuals
ProjectsWebsiteBlog
SemanVer - Manual
SemanVer - Manual
  • 👋Welcome!
  • Usage
    • 🖥️How to use
    • ⚒️How it works
  • 🧱Project Dependencies
  • Report an issue
  • Source code
  • Our projects
  • API Reference
Powered by GitBook
On this page
  1. Usage

How it works

How does SemanVer work?

Last updated 1 year ago

When SemVer.Parse() gets called with a semantic version string, it first checks the string against the SemVer compliance using the following regular expression (fetched from ). If it doesn't find any version element, such as the case of 1.0-1, it returns an error.

This is the regular expression used:

^(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-]+)*))?$

If there's a match, the next step is to extract the following information:

  • Major version (MajorVersion, int)

  • Minor version (MinorVersion, int)

  • Patch version (PatchVersion, int)

  • Pre-Release info (PreReleaseInfo, string)

  • Build metadata (BuildMetadata, string)

Finally, the parser creates a new class instance which holds all the parsed information.

⚒️
this