c#中amount字段的正则表达式是什么? [英] What is the regular expression for amount field in c#?

查看:163
本文介绍了c#中amount字段的正则表达式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





任何人都可以给出正则表达式以验证金额字段。

这样我就可以将该正则表达式与我的金额文本字段相匹配。



我的正则表达式应满足以下条件。



1)Number.Number(例如99.99)

2)数量。 (例如99.)

3).Number(例如.99)

4)数字(例如9999)



***但是它不应该允许单点(。)



我在设计器中使用了以下正则表达式的金额字段:

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



我希望匹配的正则表达式满足上述条件。



提前谢谢。

Hi,

Can anyone give regular expression to validate amount field.
So that i match that regex to my amount text field.

My regex should satisfy the below condition.

1) Number.Number (e.g 99.99)
2) Number. (e.g 99.)
3) .Number (e.g .99)
4) Number (e.g 9999)

***But it should not allow single dot (.)

I used the below regex to amount field in the designer:
@"^(([0-9]{0,9})(\.+)\d{0,2}|[0-9]{0,9})$"

I want the matching regex to satisfy the above conditions.

Thanks in advance.

推荐答案





我希望匹配的正则表达式满足上述条件。



提前致谢。
"

I want the matching regex to satisfy the above conditions.

Thanks in advance.


以下正则表达式适用于我满足以上所有条件。



@ ([^ .\d] + | [\\\ + \。] {2,})



Hogan
The following regex works for me to satisfy all of the above conditions.

@"([^.\d]+|[\d+\.]{2,})"

Hogan


阅读这篇非常好的文章 [ ^ ]
read this very good Article[^]


这篇关于c#中amount字段的正则表达式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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