Bharti Pandita
Bharti Pandita

Reputation: 291

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.

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.

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.

Upvotes: 0

Views: 155

Answers (1)

SpiderCode
SpiderCode

Reputation: 10122

you can use regular expression validator for the same.

Below is the regular expressions :

For Only 10 digits :

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

For Either 8 or 10 digits :

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

Upvotes: 2

Related Questions