Regular Expressions 101

Community Patterns

Decimal Range

1

Regular Expression
PCRE (PHP <7.3)

/
(\d+(.\d+)?-\d+(.\d+)?)
/

Description

Matches any range valid numerical range. i.e 1-5 ; 1.0-5 ; 1.0-5.0 ; 1-5.0

Submitted by James Lewis - 8 years ago