用于验证小数点后特定数字的正则表达式 [英] regular expression for validate specific digit after decimal point

查看:88
本文介绍了用于验证小数点后特定数字的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述







我想验证带有条件的十进制数



1.小数点后,只有一位数



2.小数点后,该位数为5。例如: - 1.5,2.5,33.5 ......就像那样..





我试图找出来,但只有我发现第一点(

 / ^ [0-9] *(?:\。\\\ {1})?$ /; 

)..



有什么办法可以解决。它会帮助满。

解决方案

/;

)..



有什么办法可以解决。它会帮助满。


试试这个,十进制数小数点后只有5。

 ^ \d * .5 



hi,


I want to validate a decimal number with some condition

1. After decimal point , there is only one digit

2. After decimal point ,that one digit will be 5 . eg:- 1.5, 2.5, 33.5 ....like that..


I tried to find out , but only I found the 1st point (

/^[0-9]*(?:\.\d{1})?$/;

)..

Is there is any way to solve .it will be help full.

解决方案

/;

)..

Is there is any way to solve .it will be help full.


Try this, decimal number with only a "5" after decimal point.

^\d*.5



这篇关于用于验证小数点后特定数字的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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