Regex for Mobile Number with or without Country Code
Simple regexp for Indian mobile number validation: /^[0]?[789]\d{9}$/
Support 08888888888(Zero appending) 7878787878,8634456876,9545559877(any mobile number precede by 7,8,9 and followed by other 9 digits)
Full function
function mobileNumber(){
var Number = document.getElementById('YOUR ELEMENT ID').value;
var IndNum = /^[0]?[789]\d{9}$/;
if(IndNum.test(Number)){
return;
}
else{
$('#errMessage').text('please enter valid mobile number');
document.getElementById('profile_telephoneNumber').focus();
}
}
From what I can see, this should work. The prefix is optional and is stored into the first match group, with the main number going into the second group.
^([0|\+[0-9]{1,5})?([7-9][0-9]{9})$
But if you can give us some test cases for each, it'd help us in giving you a working regex for what you want.
Props to SchlaWiener in the comments for the correct limit on the country code length.