[thelist] Email Validator
Chris Spruck
cspruck at mindspring.com
Wed Dec 5 13:41:57 CST 2001
At 08:41 PM 12/5/01 +0200, Matthew Blanchard wrote:
>>From: "Maryanna Nesina" <mar at MN1052.srv.pu.ru>
>>Subject: Re: [thelist] Email Validator
>>
>>It doesn't allow the addresses like qq at com or qq at ru
>>is it right?
>
>Yes, the code doesn't allow this. It ends in:
>
>\.[A-Za-z0-9]+$/
>
>The dot ('\.') is not quantified (that is, it is not followed, or not in a
>sub-pattern which is followed, by a quantifier (a quantifier is *,+,?,{}),
>and thus has to appear as-is in the email address.
In the above expression, you could make the dot optional by following it
with a question mark like this:
\.?[A-Za-z0-9]+$/
The question mark there means ONLY a single dot is allowed, but the dot is
optional. Change the ? to an asterisk (\.*[A-Za-z0-9]+$) and it becomes
"ANY number of dots are allowed, but they are optional". Thus the ? will
prevent the validation from passing whatever at whatever..com.
Chris
More information about the thelist
mailing list