Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Python

r"
(^(>|<)?(\d+)(\.\d+)?(\.\d+)?$| ^(\d+)(\.\d+)?(\.\d+)?-(\d+)(\.\d+)?(\.\d+)?$)
"
gm

Description

Python regex to get version numbers, including if the version number specifies a range such as 1.0-2.0 or >1.0

Submitted by jhylands - 3 years ago