Regular Expressions 101

Community Patterns

1...34567...899

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
(?<Semantic>(?<Major>[0-9]+)\.(?<Minor>[0-9]+)(?:\.(?=[0-9]))?(?<Maintenance>[0-9]+)?(?:\.(?=[0-9]))?(?<Patch>[0-9]+)?)(?<Label>(?:(?:\.|\-|\+)?\w+)+)?
/
gm

Description

Matches and groups categories of semantic versions.

Submitted by Jon Stinnett - 2 years ago