正则表达式只有小数 [英] regular expression only decimals
本文介绍了正则表达式只有小数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我需要写一个正则表达式,这将允许数字如
99.99
$ 100
thanx&respect
解决方案
试试这个:
^ \d +。\\\ +
如果你想把小数位限制为2,那么:
^ \d +。\\\ { 2}
Hello everyone,
I need to write a regular expression which will allow numbers like
99.99
100.00
thanx & regard
解决方案
try this:
^\d+.\d+
if you want to limit the decimal place to 2 only, then:
^\d+.\d{2}
这篇关于正则表达式只有小数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文