简体   繁体   English

限制MultiLine TextBox中的数值

[英]Limit the numerical value in a MultiLine TextBox

The requirement is : 要求是:

In a Multiline text box, user should be able to add either 8-digit numerical number or 10-digit numerical number separated by commas. 在多行文本框中,用户应该能够添加由逗号分隔的8-digit numerical number10-digit numerical number

Example: 1234567891,2345678911, and so on....

There is no limit on the overall length of text box , but the numerical values within the text box should be either 8 or 10. 文本框的总长度没有限制,但文本框中的数值应为8或10。

I have already written the code for limiting numerical values, but don't know how to restrict values with in the text box. 我已经编写了限制数值的代码,但不知道如何在文本框中限制值。

Help will be appreciated. 帮助将不胜感激。

you can use regular expression validator for the same. 你可以使用正则表达式验证器。

Below is the regular expressions : 以下是正则表达式:

For Only 10 digits : 仅限10位数:

^[0-9]{10}( *, *[0-9]{10})*$

For Either 8 or 10 digits : 对于8位或10位数字:

^(\d{8}|\d{10})( *, *(\d{8}|\d{10}))*$

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM