Regular Expressions 101

Community Patterns

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