Regular Expressions 101

Community Patterns

Number 0-100, 2 decimals

1

Regular Expression
PCRE (PHP <7.3)

/
^((100((\.|,)[0-9]{1,2})?)|([0-9]{1,2}((\.|,)[0-9]{0,2})?))$
/

Description

A number between 0 and 100 (including them) with up to two decimals. The decimal separator can be . or , . Usefull for percentage.

Submitted by anonymous - 9 years ago