Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Created·2019-08-06 17:39
Flavor·PCRE (Legacy)

/
^(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<preRelease>(?:[a-zA-Z1-9][a-zA-Z\d]*|0\d*[a-zA-Z][a-zA-Z\d]*|0)(?:\.(?:[a-zA-Z1-9][a-zA-Z\d]*|0\d*[a-zA-Z][a-zA-Z\d]*|0))*))?(?:\+(?<metadata>(?:[a-zA-Z\d-]*)(?:\.(?:[a-zA-Z\d-]*))*))?$
/
gm
Open regex in editor

Description

According to the spec from https://semver.org/spec/v2.0.0.html

Submitted by anonymous