正则表达式必须有两位小数 [英] a regular expression must have two decimal place

查看:207
本文介绍了正则表达式必须有两位小数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将此常规表达式更改为必须有两个小数位



how to change this regular expession to must have two decimal place



((0)+(\.[1-9](\d)?))|((0)+(\.(\d)[1-9]+))|(([1-9]+(0)?)+(\.\d+)?)|(([1-9]+(0)?)+(\.\d+)?) 



因为我尝试0.0123可以工作,但是如果我尝试1.123则不能工作,如果我尝试0.1则不能工作

我已经尝试过此[0-9] + \.[0-9] [0-9](?:[^ 0-9] | $)它在上面提到的条件下仍然有效,但对于0.00 所以我有这个文本框和一个regularexpressionvalidator,我应该如何检查0.00?



cause i try 0.0123 it work but if i try 1.123 it don''t wok, if i try 0.1 is don''t work

i have try this [0-9]+\.[0-9][0-9](?:[^0-9]|$) it work al above what i mention, but i doesnt work for 0.00
so i have this text box and a regularexpressionvalidator, how should i check against 0.00?

推荐答案

)它在我上面提到的情况下仍然有效,但对于0.00 <我却不起作用br/> 所以我有这个文本框和一个regularexpressionvalidator,如何检查0.00?
) it work al above what i mention, but i doesnt work for 0.00
so i have this text box and a regularexpressionvalidator, how should i check against 0.00?


您是说必须至少有两个小数.也许像这样:
Do you mean that you must have at least two decimals. Perhaps something like:
\d{1}.(\d){2,32}


检查此类似帖子,

SOF [ ^ ]

希望对您有所帮助.
Check this similar post,

SOF[^]

Hope it helps.


这篇关于正则表达式必须有两位小数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆