My regex for matching decimal numbers matches "1." How can I fix it? -


i got regular expression decimals:

/^(\d{1,3})(\.{0,1}\d{0,2})$/ 

but allows "1."

how fix this?

the following regex matches 1-3 digits, optionally followed decimal point , 1-2 digits.

/^(\d{1,3})(\.\d{1,2})?$/ 

note changed . \.. metacharacter matches anything, , has escaped.


Comments

Popular posts from this blog

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -

java - Getting corefrences with Standard corenlp package -

jQuery clickable div with working mailto link inside -