At 06:45 PM 6/12/01 +0200, Jos Boumans wrote:
>Please, if you try and flame posts, get your facts straight.
That seems a little harsh. I don't think it was intended as a flame or to
be insulting in any way. It was just suggesting what the author thought
was a better way to do it. :-)
>2nd: the regex is purposely written verbose, seeing this is a newbie
>list and we
>want to teach them, not scare them away by hard to follow code
OK, but if your purpose is to point out important points for the new
programmer, it seems to me that by far the most important thing to point
out here is that these expressions have nothing to do with "testing on
email characters." They will pass things that aren't valid email addresses
and they reject many things that are. The Internet is full of people doing
things like this:
if ($email =~ /[\w\.-]+\@[\w\.-]+(\.[\w\.-]+)+/){...}
which is just horrible.
Another poster to this list who hasn't said anything in this particular
thread used to address this question sufficiently often that he had an
auto-responder set up at fred&[EMAIL PROTECTED] that contained
information about not using the sort of regular expression found above. If
you like, you can reply me about this message at "foo and bar"@yoak.com
. It'll come through with no trouble at all.
I understand that there is value in exploring how character classes and the
like work in regular expressions, but someone should point out that the
proposed problem isn't solved in any of these ways.
In another post, I mentioned Email::Valid and some other conversation
about ways to do it.
Cheers,
Jeff