Validating Email

Hi I want to validate emails and I know how by using....

pattern="^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.(([a-z]{2,3})|(aero|coop|info|museum|name))$">

but...
I need to validate only 4 different types of domains.
@duq.edu, @wduq.org, @library.duq.edu, and @mathcs.duq.edu

I got this from another expert....

pattern="^[_a-z0-9-]+(\.[_a-z0-9-]+)*@duq.edu | ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@wduq.org | ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@library.duq.edu | ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@mathcs.duq.edu"

unfortunately it doesn't work...

I need another suggestion....
nau2ndAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mrichmonCommented:
How about this:

Very similar, but with minor variations - because really that is the answer if you want to use the regular expression you stated.

^[_a-z0-9-]+(\.[_a-z0-9-]+)*@duq.edu$ | ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@wduq.orgu$ | ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@library.duq.edu$ | ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@mathcs.duq.edu$



If it doesn't work then show some examples that are not working that you need to validate...
0
James RodgersWeb Applications DeveloperCommented:
how about this?

pattern="^[_a-z0-9-]+(\.[_a-z0-9-]+)*@(duq.edu | wduq.org | library.duq.edu | mathcs.duq.edu)$"
0
nau2ndAuthor Commented:
it still is not working

here is an email i try to input....i tried both solutions above and both will give me the validating message.

safura423@duq.edu

<cfinput type="text" name="EmpEmail" required="yes"
              validate="regular_expression"
            pattern="^[_a-z0-9-]+(\.[_a-z0-9-]+)*@duq.edu$ | ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@wduq.orgu$ | ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@library.duq.edu$ | ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@mathcs.duq.edu$"
            message="Please enter your Duquesne email address. For questions or to reports problems please contact Kathy Jaczesko at 412-396-5311 or jaczesko@duq.edu" value="" size="49">
0
mosphatCommented:
How about this expression?

<cfset RE = "^['_a-z0-9-]+(\.['_a-z0-9-]+)*@(duq\.edu|wduq\.org|library\.duq\.edu|mathcs\.duq\.edu)$"/>

<cfoutput>
Returns 1:
#reFindNoCase(RE, "safura423@duq.edu")#

Returns 0:
#reFindNoCase(RE, "safura423@duq.com")#
#reFindNoCase(RE, "safura423@.edu")#
</cfoutput>

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mosphatCommented:
The pattern I suggested, works with the examples provided by nau2nd. Therefore it is very likely to be the answer to the question.

Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.