Solved

Multiple regex expression

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

760 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

22 Experts available now in Live!

Get 1:1 Help Now