Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
ECMAScript (JavaScript)

/
^(?:(?:\b([0-9]|[1-9][0-9])\b)(?:\.\b([0-9]|[1-9][0-9])\b)?|.\b([0-9]|[1-9][0-9])\b)$
/
gm

Description

Percentage regex allows integer and float values e.g. 10 // valid 12 // valid 12.34 // valid 12.345 // invalid 99.99 // valid 987 // Invalid

Submitted by Ankit Patel - 2 years ago