Regex : Phone number starting with 06 or 07

后端 未结 5 1709
北海茫月
北海茫月 2021-01-26 22:02

I have this function which works only for 10 digits.

function telValide( tel )
{
    var reg = new RegExp(\'^[0-9]{10}$\', \'i\');
    return reg.test(tel);
}
<         


        
5条回答
  •  无人及你
    2021-01-26 22:36

    Try it /^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/ and for more details check below links help you how validate your phone and defined specific format

    http://www.zparacha.com/phone_number_regex/

    http://dzone.com/snippets/regular-expression-validate

提交回复
热议问题