Solved

cell phone - regex pattern

Posted on 2013-06-24
1
561 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This video discusses moving either the default database or any database to a new volume.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now