showing results for - "validador de telefone javascript"
Malena
16 Feb 2017
1function validPhone (phone) {
2    var regex = new RegExp('^\\([0-9]{2}\\)((3[0-9]{3}-[0-9]{4})|(9[0-9]{3}-[0-9]{5}))$');
3    return regex.test(phone);
4}
5
6validPhone('(31)3534-2323'); //Valido
7validPhone('(31)9923-23288'); //Valido
8validPhone('(31)9923-3288'); //Invalido
9validPhone('(31)2323-5443'); //Invalido