Regex : Phone number starting with 06 or 07

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);

I would like to check phone number starting with 06 or 07.

Ex :

06 01010101 : true

07 01240101 : true

00 04343000 : false


var reg = new RegExp('^((06)|(07))[0-9]{8}$', 'i');

I guess it's a simple case:


'^0(6|7) [0-9]{8}$'

Or if you mean you want the numbers without a space:


Check out some excellent regex tutorials here and here.

The easiest pattern would probably be



  • 0
  • 6 or 7
  • a digit
  • repeated exactly eight times

That assumes that your white space is merely for emphasis.

You could also be fancy and use a lookahead


This isn't really adding much expect complexity however.

Need Your Help

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.