Regular Expressions 101

Community Patterns

Dynamic Length Version Parser

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 - a year ago