Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^ (?>0|[1-9]\d*)\. (?>0|[1-9]\d*)\. (?>0|[1-9]\d*) (?>-([a-z-][\da-z-]+|[\da-z-]+[a-z-][\da-z-]*|0|[1-9]\d*)(\.(?>[a-z-][\da-z-]+|[\da-z-]+[a-z-][\da-z-]*|0|[1-9]\d*))*)? (?>\+[\da-z-]+(\.[\da-z-]+)*)? $
/
gmix

Description

Matches SemVer 2.0 version strings without any capture groups.

Submitted by anonymous - 5 years ago