Solved

Multiple regex expression

Posted on 2013-01-16
2
504 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 500 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
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: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

628 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