In this article I will explain with an example, how to implement Indian Mobile Number validation using RegularExpressionValidator in ASP.Net.
The Indian Mobile Number entered in the TextBox will be validated using Regular Expression (Regex) and ASP.Net RegularExpressionValidator.
HTML Markup
The following HTML Markup consists of a TextBox, an ASP.Net RegularExpressionValidator and a Button control.
The RegularExpressionValidator has been set with a Regular Expression for validating Mobile Number in the ValidationExpression property.
The following conditions must satisfy for a Mobile Number to be termed as valid.
1. It should be 10 digits long.
2. The first digit should be a number. 6 to 9.
3. The rest 9 digits should be any number. 0 to 9.
4. It can have 11 digits including 0 at the starting.
5. It can have 12 digits including 91 at the starting.
Examples: 9876543210, 09876543210, 919876543210
Mobile Number:
<asp:TextBox ID="txtMobileNumber" runat="server" />
<asp:RegularExpressionValidator ID="rgxMobileNumber" runat="server" ControlToValidate="txtMobileNumber"
    ValidationExpression="(0|91)?[6-9][0-9]{9}" ErrorMessage="Invalid Mobile Number." ForeColor="Red">
<hr />
<asp:Button ID="btnSubmit" Text="Submit" runat="server" />
Indian Mobile Number validation using RegularExpressionValidator in ASP.Net