文本框中的数值验证 [英] numeric validation in textbox

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

问题描述

我希望文本框的来源仅输入电话号码,并允许+进入文本框的起始电话号码.例如:+65478474632

i want source for textbox only enter phone number and allow + into the textbox starting phone number. for ex:+65478474632

推荐答案

使用模式为^\+?\d+
Using a regular expression validator with the pattern ^\+?\d+


的正则表达式验证器将执行您需要的验证

^\+?表示文本只能在文本开头包含零个或一个+ charcater实例.

\d+
will perform the validation you need

^\+? means that the text can contain zero or one instance of the + charcater at the start of the text only

\d+


表示文本必须在文本末尾之前包含一个或多个数字

我建议您下载Expresso之类的免费工具,以帮助您进行正则表达式创建过程
means that the text must then contain one or more digits before the end of the text

I would recommend that you download a free tool like Expresso to help you with your regex creation process


这篇关于文本框中的数值验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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