Regular expression for validating numbers in asp net

You need TWO validator controls to ensure only numeric values are entered.

can anybody help me regarding regular expreesion for mobile number should allow only numbers and should contain 10digits. some are giving error when i entered bellow 10 if i enter 12 digits error is not giving.

Regex class for validate any input string for any specific format.

Similarly if we want to validate phone number like xxx-xxx-xxxx format then you can use ā€œ\d-\d-\dā€.

But, if you need to validate more demanding pattern, like e-mail address, URL or credit card number, classic approach with string manipulation will take significant time and result with a long code.

regular expression for validating numbers in asp net-4

You can use the Regular Expression Validator for almost everything, for instance validating an e-mail or an URL.

In this case, you can validate data using Regex class from System. Client side validation works faster, since there is no need to send request to server.

So, to provide better user experience, you should consider client side validation which executes as Java Script client code.

If you want to use regular expression for validating phone or mobile numbers followed by country code.

What is the Regular Expression Validator for only Letters and Numbers in asp.net? I don't want to allow any special characters single or double quotes etc.

571

Leave a Reply