Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Created·2023-03-08 17:24
Flavor·PCRE2 (PHP)

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

Description

Matches and groups categories of semantic versions.

Submitted by Jon Stinnett