---
id: "semver"
kind: "datatype"
status: "stable"
is_pii: false
categories: ["software"]
langs: ["common"]
quality: 85
url: "http://registry.apicrafter.io/datatype/semver"
---

# Semantic version (SemVer) (`semver`)

Version number in the Semantic Versioning 2.0.0 format: MAJOR.MINOR.PATCH, optionally followed by a pre-release part after '-' and build metadata after '+'.

- Personal data (PII): no
- Categories: Software development (software)
- Countries: global
- Languages: Common to most languages (common)
- Classification: identifier

## Detection

Regular expression (Python `re`):

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

## Examples

- `1.0.0` — release
- `2.1.3-alpha.1` — pre-release
- `1.0.0-rc.1+build.5` — pre-release with build metadata
- `1.0` (invalid example) — PATCH is missing
- `01.2.3` (invalid example) — leading zero

## Metacrafter rules

1 rules: 0 match the field name, 1 match values.

- `semverbyvalue` (data, `common/software.yaml`)

## Supported by tools

- `metacrafter`

## Sources

- doc: <https://semver.org/spec/v2.0.0.html>

## Quality

Score 85/100. Missing: mapping (Wikidata, Schema.org, ...), translation.

JSON: <http://registry.apicrafter.io/api/v1/datatypes/semver.json> · Edit: <https://github.com/apicrafter/metacrafter-registry/edit/main/data/datatypes/any/software/semver.yaml>
