Regular Expressions 101

Community Patterns

1...34567...902

Community Library Entry

1

Regular Expression
ECMAScript (JavaScript)

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

Description

Positive number with 10 digits before decimal point (possible zeros in front) and 0-2 digits after (possible trailing zeros).

Submitted by Evgeny Sinitsyn - 8 years ago