Displaying page
of
pages;
Items to
Title |
Test
Details
Mobile Number Validation
|
Expression |
^((\+)?(\d{2}[-]))?(\d{10}){1}?$
|
Description |
Indian mobile no. with country code as optional
example:--
function validate()
{
var filter1=/^((\+)?(\d{2}[-]))?(\d{10}){1}?$/,filter2=/^((\+)?(\d{2}[-])(\d{2}[-]))?(\d{8}){1}?$/;
var mobileNo=$("#mobileNo").val(),temp=0;
if (filter1.test(mobileNo)) {
//temp++;
}
if (filter2.test(mobileNo)) {
temp++;
}
if (temp>0) {
alert("Matched with given format!");
} else {
alert("Not Matched with given format!");
}
here mobileNo is an input filed in my html page.. you can use it as per your need..
|
Matches |
+91-9822345654,9822345654,+91-80-25746669
|
Non-Matches |
+923-9855777897,6463466
|
Author |
Rating:
Deepak Goswami
|
Displaying page
of
pages;
Items to