Validating Email

Posted on 2004-11-03
Last Modified: 2013-12-24
Hi I want to validate emails and I know how by using....


I need to validate only 4 different types of domains.,,, and

I got this from another expert....

pattern="^[_a-z0-9-]+(\.[_a-z0-9-]+)* | ^[_a-z0-9-]+(\.[_a-z0-9-]+)* | ^[_a-z0-9-]+(\.[_a-z0-9-]+)* | ^[_a-z0-9-]+(\.[_a-z0-9-]+)*"

unfortunately it doesn't work...

I need another suggestion....
Question by:nau2nd
    LVL 35

    Expert Comment

    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-]+)*$ | ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@wduq.orgu$ | ^[_a-z0-9-]+(\.[_a-z0-9-]+)*$ | ^[_a-z0-9-]+(\.[_a-z0-9-]+)*$

    If it doesn't work then show some examples that are not working that you need to validate...
    LVL 24

    Expert Comment

    how about this?

    pattern="^[_a-z0-9-]+(\.[_a-z0-9-]+)*@( | | |$"

    Author Comment

    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.

    <cfinput type="text" name="EmpEmail" required="yes"
                pattern="^[_a-z0-9-]+(\.[_a-z0-9-]+)*$ | ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@wduq.orgu$ | ^[_a-z0-9-]+(\.[_a-z0-9-]+)*$ | ^[_a-z0-9-]+(\.[_a-z0-9-]+)*$"
                message="Please enter your Duquesne email address. For questions or to reports problems please contact Kathy Jaczesko at 412-396-5311 or" value="" size="49">
    LVL 6

    Accepted Solution

    How about this expression?

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

    Returns 1:
    #reFindNoCase(RE, "")#

    Returns 0:
    #reFindNoCase(RE, "")#
    #reFindNoCase(RE, "")#

    LVL 6

    Expert Comment

    The pattern I suggested, works with the examples provided by nau2nd. Therefore it is very likely to be the answer to the question.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    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.

    Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
    Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    737 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

    19 Experts available now in Live!

    Get 1:1 Help Now