Regular expression for email to allow only two domain

I have to create a regular expression for email id like this

xyz@yahoo.com and xyz@gmail.com

I need to allow only yahoo and gmail as the domain not any other domain. I have used this expression \w+([-+.]\w+)*@yahoo.com . It is working fine for yahoo. but I want to include gmail also. How can I modify it to except gmail also?

I am using ASP.NET 2.0

Answers


Replace:

yahoo\.com

with:

(yahoo\.com|gmail\.com)

or:

(yahoo|gmail)\.com)

Need Your Help

RavenDB Faceted Search: I'm getting wrong hits for price ranges

ravendb

I'm trying to implement this faceted search logic: http://ravendb.net/docs/2.0/client-api/faceted-search. But the hits of every price range, that are returned from the database, do not work as expe...

In Jmeter How can I use a captured regex variable as part of a file name?

regex jmeter

I'm having some difficulty using a variable containing a regex capture as part of the file name in a 'Save Response to a file' listener. I am able to use the captured variable in an if controller