Regular Expressions 101

Community Patterns

Community Library Entry

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