Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^(\d+\.)?(\d+\.)?(\d+)$
/
gm

Description

Match a semantic version string, but numbers only (e.g. 1.2.3). Ignore things like dev, patch, src, etc.

Submitted by Geddings - 3 years ago