Answers for "validador de telefone javascript"

1

validador de telefone javascript

function validPhone (phone) {
    var regex = new RegExp('^\\([0-9]{2}\\)((3[0-9]{3}-[0-9]{4})|(9[0-9]{3}-[0-9]{5}))$');
    return regex.test(phone);
}

validPhone('(31)3534-2323'); //Valido
validPhone('(31)9923-23288'); //Valido
validPhone('(31)9923-3288'); //Invalido
validPhone('(31)2323-5443'); //Invalido
Posted by: Guest on July-07-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language