I need to validate the mobile number
- first text input starting with 04
- should be total 10 digits including 04(eg : 0412345678)
my input field is below
<form name="uploadForm">
<input type="tel" name="MobileNumber" id="MobileNumber" data-ng-model="ApplicationData.MobileNumber" required maxlength="14" data-ng-pattern="/^(0?4[0-9]{8}/\s)$/">
<span data-ng-show="uploadForm.MobileNumber.$error.pattern">Please enter a valid mobile number.</span>
<input type="tel" name="Number" id="Number" data-ng-model="ApplicationData.Number" required maxlength="14" data-ng-pattern="/(^1300\d{6}$)|(^1800\d{6}$)|(^0[2|3|7|8]{1}[0-9]{8}$)|(^04\d{2,3}\d{6}$)/">
<span data-ng-show="uploadForm.Number.$error.pattern">Please enter a valid mobile number.</span>
</form>
any one can you help me please ?
I think for your first question replace with this regexp. it accepts space in between number.
for your second question, its quite long this is what i can come up with at this moment.
any body have interest to modify/short this one.
If I understand this correctly, this is your regex pattern.
^04[0-9]{8}$
^04
- starts with 04[0-9]{8}
- matches the next 8 digits$
- matches end of string