All:

I've been using a regex found on this list to validate email addresses.
I've now run into a problem with the regex that I can't solve.  Any help
would be greatly appreciated.

The email address is not required so the field can either be left blank or
must contain a valid email address.  The regex validation code follows:

<CFIF (Len(Trim(FORM.Email)) NEQ 0) AND
(REFindNoCase("^[a-zA-Z]([[:alnum:]\-_]+\.?)*@([[:alnum:]\-_]+\.)+[a-zA-Z]{2
,4}$", FORM.Email) EQ 0)>
Email address is invalid
</CFIF>

The email address is of the form "[EMAIL PROTECTED]" (that is, the domain
contains a dash).  If I remove the dash from the domain, the address
validates.  However, the dash should be valid.

Looking at the regex, doesn't the ([[:alnum:]\-_]+\.) portion after the @
symbol allow for dashes?

TIA

--
Mosh Teitelbaum
evoch, LLC
Tel: (301) 942-5378
Fax: (301) 933-3651
Email: [EMAIL PROTECTED]
WWW: http://www.evoch.com/
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to