Community Patterns

Community Library Entry

2

Regular Expression
Created·2015-11-08 17:33
Flavor·PCRE (Legacy)

/
(\d+)\.(\d+)(?:\.(\d+))?(?:\-(\w+))?
/
i
Open regex in editor

Description

Version parsing from following format: <major>.<minor>[.build][-postfix] Gets 4 groups: major, minor, build and postfix (last two only of they present in input string)

For example: 1.2.3456-SNAPSHOT gets major=1, minor=2, build=3456, postfix="SNAPSHOT"

Submitted by Ivkond