Seth,
Corrected RE is below. Toward the end, I added a \ at *\.[[:alpha:]]{2,}$
"^([[:alnum:]][-a-Sa-Z0-9_%\.]*)?[[:alnum:]]@[[:alnum:]]
[-a-Sa-Z0-9%\> .]*\.[[:alpha:]]{2,}$"
Everything else looks correct, except that it accepts spaces and the ">"
character within the host name. Are those actually valid or is it
possible that you miscopied the RE at this point ( the section with
"[-a-Sa-Z0-9%\> .]" ) ? I'd like to know, since I use virtually the same
RE, except for this bit.
The $ at the end functions exactly like the ^ at the beginning. It
functions as an anchor and says "the string must end here". Otherwise,
any string that _begins_ with a match for the RE is seen as a match and
return TRUE. Using both ^ and $ means that the whole string must be a
match for the pattern, rather than just _containing_ the pattern.
Jim
-----Original Message-----
From: Seth Petry-Johnson <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Sunday, June 18, 2000 10:34 PM
Subject: Re: REGEX validating email
>Chris,
>
>Way back in the beginning of April you posted the following regexp to the
>CF-Talk as a regexp that can be used to check whether or not a string is
a
>properly formatted email address.
>
>> Here's the code I use
>>
>> <CFSET IsEmail =
>>
>REFind("^([[:alnum:]][-a-zA-Z0-9_%\.]*)?[[:alnum:]]@[[:alnum:]][-a-zA-Z0-
9%\
>> .]*.[[:alpha:]]{2,}$", email)>
>
>I liked your regexp so much more than my long, drawn out method so I cut
and
>pasted your code into my templates and went about my business. Well, I
just
>discovered that the above regexp has a flaw. My regexp skills aren't
quite
>as sharp as they should be, so I haven't had the best of luck figuring
out
>the problem on my own.
>
>The problem I have is that this regexp returns true on a string
containing
>some alpha numeric characters, the "@", and then 4 more characters
EXCLUDING
>a period. For example, if I pass "seth@argo" to the regexp it returns
true,
>signifying that the string is in fact a valid email address. If there
are
>three or less characters after the "@" then it correctly returns false.
The
>logic of the regexp SEEMS correct to me, and I can't seem to figure out
why
>this is happening. I've double checked my code 4 times, and I have
EXACTLY
>what you posted to the list.
>
>Could you please check and make sure that this is indeed the regexp that
you
>use (i.e. make sure there are no typos). If it is NOT could you be so
kind
>as to send me the correct one? If this IS what you are using then you
might
>want to check and see if your sites suffer from the same error.
>
>Finally, one last and final question: the only character in your regexp
>that I don't understand is the "$" at the very end. I can't find an
>explanation of this meta character anywhere in Forta's section on regular
>expressions. What exactly does this character do?
>
>Regards,
>Seth Petry-Johnson
>Argo Enterprise and Associates
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.