Solved

cell phone - regex pattern

Posted on 2013-06-24
1
564 Views
Last Modified: 2013-06-24
I am looking a regex pattern for cell phone( sample : 1234567890 or (123)4567890.
0
Comment
Question by:VBdotnet2005
1 Comment
 
LVL 35

Accepted Solution

by:
Terry Woods earned 500 total points
ID: 39273471
If it's as simple as those two exact formats, then this pattern will match both:
^(\(\d{3}\)|\d{3})\d{7}$

Open in new window


If you need to vary the number of digits (eg such as an optional extra digit), then you can add flexibility like this:
^(\(\d{3}\)|\d{3})\d{7,8}$

Open in new window

0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB: Convert 2 dates to specific format 24 48
VB.net Open Folder in Windows Explorer 3 31
get column names from table in vb.net 8 30
vb.net 1 month apart 11 31
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question