印度固定线验证的正则表达式 [英] Regular expression for indian landline validation
问题描述
我需要验证印度固定电话号码。
印度固定电话号码的最大长度为11.
它将以6-8位后的标准码开头。
喜欢这个。
044-444444
044-44444444
04175- 22222
但它不会超过11
i已经给出了这样的验证
^ [0-9] \d {2,4} -\d {6,8} $
以上正则表达式接受超过11位数。
在上面的正则表达式我需要给出最大长度。
怎么办?
以上正则表达式接受超过11位数。
在上面的正则表达式我需要给出最大长度。
怎么做?
解决方案:
查看此链接电话号码验证
让我知道是否仍然发现它很难。
< blockquote>你可以使用
< asp:TextBox ID = tbTelephoneNo runat = 服务器 > < / asp:TextBox >
< asp:RegularExpressionValidator ID = RegularExpressionValidator1 runat = 服务器 ControlToValidate = tbTelephoneNo ValidationExpression = ^ \d {5,8}
I need to validate india landline numbers.
maximum length of indian landline number is 11.
it will starts with std code after that 6-8 digits.
like this.
044-444444
044-44444444
04175-22222
but it wont exceeds 11
i have given validation like this
"^[0-9]\d{2,4}-\d{6,8}$"
the above regular expression is accepting more than 11 digits..
in the above regex i need to give maximum length.
how to do that?
解决方案 "
the above regular expression is accepting more than 11 digits..
in the above regex i need to give maximum length.
how to do that?
Solution:
Check this Link Phone number validation
Let me know if still found it hard.
you can use
<asp:TextBox ID="tbTelephoneNo" runat="server"></asp:TextBox> <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="tbTelephoneNo" ValidationExpression="^\d{5,8}
这篇关于印度固定线验证的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!