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

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -