This is a sample code for our phone number validation. A developer has written a regex like 00[0-35-6]
but I am not sure what does it mean
Will it allow 0035 but not 0036 an then what the remaining -6 do?
function testRegex(regex, input) {
const pattern = new RegExp(regex);
const result = pattern.test(input);
return result;
}
const regex = "00[0-35-6]";
const inputString = "0027";
const isMatch = testRegex(regex, inputString);
console.log(`Does "${inputString}" match the regex "${regex}"? ${isMatch}`);