关于通过正则表达式在文本框中应用验证。 [英] Regarding Applying validation in textbox through Regular Expression.

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

问题描述

您好开发者



我正在尝试在Textbox控件中应用验证以限制控件中的空白区域。以下是我正在使用的正则表达式代码:





Regularexpression validationexpression =^ [^ - \ s] [a- zA-Z0-9_\ - - ] + $errortext =/>



现在我的要求是:

1-用户不应该在开始时输入空格。 (工作正常)

2-文本框限制最多为10个数字,用户可以输入他想要的数量,如果输入少于10个数字则无需验证。 (工作正常。)

3-验证应该提示用户输入的数字如111 111,表示如果数字之间有空格则显示验证。 (不工作)



目前我正在使用以下正则表达式来实现此功能,请让我知道或更新我的正则表达式,以便我可以达到这个要求。 br $>


Regularexpression validationexpression =^ [^ - \ s] [a-zA-Z0-9_\ - - ] + $errortext =/>



谢谢。



问候,

解决方案

errortext =/>



现在我的要求是:

1-用户不应该输入空格开始工作。(工作正常)

2-文本框限制最多为10个数字,用户可以输入他想要的数字,如果输入少于10个数字则无需验证。(工作正常。)

3-验证应该提示用户输入的数字如111 111,表示如果数字之间有空格则显示验证。(不工作)



目前我正在使用以下正则表达式来实现这个目的,请让我知道或更新我的正则表达式,这样我就能达到这个要求。



Regularexpression validationexpression =^ [^ - \ s] [a-zA-Z0-9_\s - ] +


errortext =/>



谢谢。



问候,


参考这个

< a href =http://stackoverflow.com/questions/2842823/how-to-prevent-white-spaces-in-a-regular-expression-regex-validation> http://stackoverflow.com/questions/2842823 /如何对防止-的空格功能于一个正则表达式正则表达式验证

Hello Developers

I am trying to applying validation in Textbox control for limiting empty space in control. Following is the Regular Expression code I'm using:


Regularexpression validationexpression="^[^-\s][a-zA-Z0-9_\s-]+$" errortext="" />

Now my requirement is:
1- User should not enter empty space in begining. (Working fine)
2- Textbox limit is upto 10 numbers, user will able to enter as much as number he wants, no validation if he enter less than 10 numbers. (Working fine.)
3- validation should prompt if user enter the numbers like this "111 111 ", means show validation if there is empty space between numbers. (Not working)

Currently I'm using following Regular Expression to achieve this thing, please let me know or update my regular expression so I can achieve this requirement.

Regularexpression validationexpression="^[^-\s][a-zA-Z0-9_\s-]+$" errortext="" />

Thank you.

Regards,

解决方案

" errortext="" />

Now my requirement is:
1- User should not enter empty space in begining. (Working fine)
2- Textbox limit is upto 10 numbers, user will able to enter as much as number he wants, no validation if he enter less than 10 numbers. (Working fine.)
3- validation should prompt if user enter the numbers like this "111 111 ", means show validation if there is empty space between numbers. (Not working)

Currently I'm using following Regular Expression to achieve this thing, please let me know or update my regular expression so I can achieve this requirement.

Regularexpression validationexpression="^[^-\s][a-zA-Z0-9_\s-]+


" errortext="" />

Thank you.

Regards,


refer this
http://stackoverflow.com/questions/2842823/how-to-prevent-white-spaces-in-a-regular-expression-regex-validation


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

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