I use

function IsEmail(str)
{
var sInvalidCharsPattern = "[^[:alnum:[EMAIL PROTECTED]']";
var sFormatPattern =
"([a-z0-9][-._a-z0-9]*)[EMAIL PROTECTED]([a-z0-9][-_a-z0-9]*\.)+[a-z]{2,7}";
var sStrippedEmail = REReplaceNoCase(Trim(str),
sInvalidCharsPattern, "", "ALL");

str = Trim(str);

if (Len(str) EQ Len(sStrippedEmail))
return IIF(REFindNoCase(sFormatPattern, str) EQ 1, true, false);
else
return false;
}

which allowed the -

HTH

Mike

On Thu, 1 Jul 2004 11:56:23 -0400, Mosh Teitelbaum
<[EMAIL PROTECTED]> wrote:

> 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
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to