I need to validate a Textbox in my Asp.Net application where the user can enter mobile number and it should starts with 078 and should contain 10 digits.
Sample:
Why don't you try this? The below regex would validate for phone numbers which should be starts with 078
followed by any 7 digit number.
^078\d{7}$
DEMO
Explanation:
^
Asserts that we are at the start.078
Matches exactly the digits 078
.\d{7}
Matches the following 7 digits.$
End of the line.IDEONE
^078[0-9]{7}$
This is a bit faster than \d
if we use only numbers here.