Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^(?'major'\d+)\.(?'minor'\d+)(?:\.(?'patch'\d+))?(?:-(?'preRelease'(?:(?'preReleaseId'[0-9A-Za-z-]+)\.?)+))?(?:\+(?'build'(?:(?'buildId'[0-9A-Za-z-]+)\.?)+))?$
/
mg

Description

Recognizes and splits a semantic version into its component parts

Submitted by Ben Leggiero - 7 years ago