任何人都能纠正这个正则表达式吗? [英] Can any one correct this regular expression??

查看:129
本文介绍了任何人都能纠正这个正则表达式吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正常表达式验证货币值最多2个小数位
如果它工作正常除了一件事


当我必须输入整数值时我必须输入111.00而不是111
任何一个允许整数+双值最多2位小数????

^([1-9] [0-9] {0,9} \。[0-9] {2} | 0 + \。[1-9] [0-9] | 0 + \。[0-9] [1-9])$

任何帮助都会被评估..

it is regular expression to validate currency value upto 2 decimal places
if it is working fine except one thing


when ever i have to enter integer value i have to type  111.00 instead of 111
can any one allow integers + double values upto 2 decimal places in it????

^([1-9][0-9]{0,9}\.[0-9]{2}|0+\.[1-9][0-9]|0+\.[0-9][1-9])$

any help would be appriciated..

推荐答案

为什么不查看regeix if 功能,并根据您遇到的if场景进行匹配。我讨论在我的博客正则表达式和If条件上使用if。

那应该让你朝着正确的方向前进。 GL HTH
Why don't you look into the regeix if functionality and base the match off of the if scenarios which you are encountering. I discuss using the if on my blog Regular Expressions and the If Conditional.

That should start you in the right direction. GL HTH


这篇关于任何人都能纠正这个正则表达式吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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