Email Id Verification

Chris Angelico rosuav at gmail.com
Thu May 24 08:41:41 EDT 2012


On Thu, May 24, 2012 at 10:32 PM, niks <nikunjparmar.it at gmail.com> wrote:
> Hello everyone..
> I am new to asp.net...
> I want to use Regular Expression validator in Email id verification..
> Can anyone tell me how to use this and what is the meaning of
> this
> \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

This is a mailing list about Python, not ASP, and not regular
expressions. Every regex library is different, some more than others,
so your best bet is to find documentation on the actual
function/library you'll be using.

But I would strongly recommend NOT using a regex to validate an email
address. It's prone to false positives and false negatives. There are,
unfortunately, many systems around which do not accept legal addresses
(for instance, "this.is.valid+1 at rosuav.com" is, as the name suggests,
quite valid - as is "fred_foobar@[203.214.67.43]"); part of the blame
can be laid on PHP's inbuilt validation functions, but I know that
several are implemented using a fairly simple and brutally wrong
check.

Validate the domain part (the bit after the @) with a DNS lookup,
nothing more and nothing less. If you absolutely must do a
syntactic/charset check, read the appropriate RFCs and figure out what
really is and isn't legal. You will be surprised. (For instance,
"foo at localhost" is a perfectly valid address, because "localhost" is a
top-level domain.)

Chris Angelico



More information about the Python-list mailing list