Regular Expressions 101

Community Patterns

Community Library Entry

2

Regular Expression
ECMAScript (JavaScript)

/
^\s*[0-9]+([\,\.][0-9][0-9]{0,2})?$|^$|^\s*$
/

Description

//Accepts whitespaces and positive numeric values including integers and decimals(dot or comma optional) with 3 precisions only.

//Ex: "999", " 999.999", " 999.999",
" 999,999", " 999,999" -> ACCEPTABLE

Submitted by Pubudu (motustudio) - 9 years ago