简体   繁体   中英

Can we validate .0 using regex

I'm doing a field that will only accept whole numbers. So I did a regex validation like this /^\\d{1,3}$/ this is validating whole number entry and does not allow decimal from .1 eg it will make 1.1 invalid but when I tried to input 1.0 it accepted it. Is there a regex that will also check .0?

^\\d{1,3}(\\.0)?$接受一,两位或三位数的整数以及它们以.0结尾的数字。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM