I am trying to implement control validation using Javascript.
The validation criteria states that the number should consist of a maximum of 12 digits, with the first 7 being '9900000' followed by either a '0' or a '1', and ending with any combination of 4 numbers.
I have defined the validator as follows:
var validator = new RegExp("/^9900000[0-1]{3}\[0-9]{4}/");
However, the current implementation does not seem to be working correctly. What could be the issue?
EDIT:
var check = 990000014212;
var validator = new RegExp("/^9900000[0-1][0-9]{4}$/");
console.log(validator.test(check));
if (validator.test(check))
{
console.log("Valid");
}
else
{
console.log(check);
console.log("Invalid");
}
Why is it always returning "Invalid" and false?