Link to home
Start Free TrialLog in
Avatar of nau2nd
nau2nd

asked on

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....
Avatar of mrichmon
mrichmon

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...
Avatar of James Rodgers
how about this?

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

ASKER

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">
ASKER CERTIFIED SOLUTION
Avatar of mosphat
mosphat

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The pattern I suggested, works with the examples provided by nau2nd. Therefore it is very likely to be the answer to the question.

Thanks.