-
-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
修改实例:小数点后几位 #4
Comments
Closed
精简一下 /^(0|[1-9]\d*)(.\d+)$/.test(0.23)
// => true 原示例修改 - /^[0-9]+(.[0-9]{2})?$/.test(0.000) //=> true
+ /^[0-9]+(.[0-9]{2})$/.test(0.000) //=> false /^[0-9]+(.[0-9]{2})$/.test(0.000) //=> false |
/^(0|[1-9]\d*)(.\d+)$/.test(0.00)
//=> false 你这个正则也不太行 |
换成字符串就行了,而且我觉得 /^(0|[1-9]\d*)(.\d+)?$/ 应该需要,在写业务中,用来校验表单的 /^(0|[1-9]\d*)(.\d+)$/.test('0.00')
//=> true |
@cuilanxin 已经更改 |
非零,俩位,最大 99999999.99/^(0|[1-9]\d{0,7}).?(([1-9]{1,2}?)|(0[1-9]))$/g |
@cuilanxin 已添加 |
非零,最多俩位小数/^(?!^0(.0{1,2})?$)\d*(\.\d{1,2})?$/g |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
❌正则:^(0|[1-9]\d*)(.\d+)?$
The text was updated successfully, but these errors were encountered: