The following is my code:
<html>
<title>Validate Phone Number</title>
<head>
<script>
function testnumber() {
var ph = new RegExp("^[789]\d{9}$");
num = {10 digit phone number}
alert(ph.test(num));
}
testnumber();
</script>
</head>
<body>
</body>
</html>
I want to validate mobile phone number which starts with 7/8/9 and is 10 digit. But it alerts false for any phone number given as input.
Please tell me where am I going wrong. Thanks in advance.