Solved

cell phone - regex pattern

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

929 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

17 Experts available now in Live!

Get 1:1 Help Now