Regular Expressions 101

Community Patterns

1...45678...901

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
(?<Major>[a-zA-Z0-9]+)(?:\.([a-zA-Z0-9]+))+(?<Label>(?:(?:\-|\+)?\w+)+)?
/
gm

Description

Matches on version syntax, grouping the Major version alone, Minor-Patch, and Label alone.

Submitted by Jon Stinnett - 2 years ago