Regular Expressions 101

Community Patterns

Match range [1 ... 9999.99]

1

Regular Expression
PCRE (PHP <7.3)

/
^[0-9]{0,4}(?(?=\.)\.\d{0,2})
/
g

Description

This helps matching numbers where decimals are optional

Submitted by AndrewEastwood - 2 years ago