Community Patterns

Community Library Entry

1

Regular Expression
Created·2024-04-14 22:37
Updated·2024-04-14 22:38
Flavor·PCRE2 (PHP)

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

Description

Semver 2.0.0 rwith named groups for those systems that support them (PCRE [Perl Compatible Regular Expressions, i.e. Perl, PHP and R], Python and Go). Source: https://semver.org/

Submitted by Soma Szelpal