?
Solved

Multiple regex expression

Posted on 2013-01-16
2
Medium Priority
?
505 Views
Last Modified: 2013-01-16
Hi,

I have a c# asp.net mvc 3 application.

I have a phone number that current has a regex of this:

^[2-9]\d{2}-\d{3}-\d{4}$

which is ###-###-####

I need to add another phone number format like this:

(+### #) #######

What is the best way to approach this? Is there a multiple regex or a conditional reg ex I can use?  Can I put an OR in the reg ex? What would be the new reg ex format?

Thanks...
0
Comment
Question by:michael1174
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 2000 total points
ID: 38782134
^([2-9]\d{2}-\d{3}-\d{4}|\(\+\d{3} \d\) \d{7})$
0
 
LVL 2

Author Closing Comment

by:michael1174
ID: 38782278
Looks like it works, thank you very much.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

718 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