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

c# - IMAP GMAIL getting folder list problem -

CUDA shared memory -