正则表达式的验证表达式 [英] Validation Expression for Regex

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

问题描述



我想知道正则表达式验证表达式,该表达式仅接受TextBox的小数和整数.

例如:

它应该只接受此值

1
2
3
1.22
2.33
42344.54
43434.00

我已经给出了验证表达式/^(\d+(?:[\.]\d{2})?)$/,但是它仅接受整数,因此不允许我输入十进制值.谁能帮我解决这个问题.

在Advance

Hi,

I want to know the Regex Validation Expression for accepting only Decimals and Integers for the TextBox.

Eg:

It should accept only this values

1
2
3
1.22
2.33
42344.54
43434.00

I have given the Validation Expression /^(\d+(?:[\.]\d{2})?)$/ but it is accepting only integers it is not allowing me to enter decimal values. Can any one help me to solve this problem.

Thanks in Advance

推荐答案

/中表示感谢,但是它仅接受整数,因此不允许我输入十进制值.谁能帮我解决这个问题.

在此先感谢
/ but it is accepting only integers it is not allowing me to enter decimal values. Can any one help me to solve this problem.

Thanks in Advance


评估复杂和实数数学计算器 [ ^ ]

您可以在此处使用此代码:
Evaluate Complex and Real Math Calculator[^]

You could use this code here:
Dim Real As String = "(?<!([E][+-][0-9]+))([-]?\d+\.?\d*([E][+-]" & _
         "[0-9]+)?(?!([i0-9.E]))|[-]?\d*\.?\d+([E][+-][0-9]+)?)(?![i0-9.E])"


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

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