Re: CODE: Regexp/email check

From: Peter Ajamian (
Date: 06/07/01

Torgny 'Artovil' Bjers wrote:
> To be exact, I want to do this:
> /^[#-'*+\-/-9\=\?a-z\^\_\`\{\}\~](\.{0,1}[#-'*+\-/-9\=\?a-z\^\_\`\{\}\~])*@([A-Za-z0-9_]+\.{1})+[A-Za-z]{2}[A-Za-z]*$/

Oh boy, looking at that gives me a headache.  At a glance I can see that
you left out uppercase before the @ sign, and there are ways you could
simplyfy that regexp greatly.  Also, while there are none that I am aware
of, is there any particular _rule_ that says that the top level domain
can't contain numbers?  I believe that there _is_ a rule that says that a
domain name can contain dashes (-) but not underscores (_) so you got
that part wrong also.  There's a danger to using regexps to check email
addresses, you may end up rejecting valid addies if your regexp is not
perfect, also just because an email addy conforms to a set of rules
really has little to do with wheather it is valid or not.

> Id est, check the email to see if it is a valid email address.
> If there is another way to check the email address that the user input upon
> character creation than to check it like this with a reg exp, then I am
> very interested in hearing about it.

What I do on RD is to simply send an email to the email address
provided.  That email contains an unlocking code which is required to
enter the game for the first time.  It doesn't check to see if the email
addy conforms to any "rules", but I could care less about rules as long
as it works.

Regards, Peter

   | FAQ: |
   | Archives: |

This archive was generated by hypermail 2b30 : 12/05/01 PST