RFC2822::EmailAddress

J

Josselin

I am checking email addresses using RFC2822::EmailAddress

address =~ RFC2822::EmailAddress

seems to work fine, but I wonder why an email address like :
me@somewhere is accepeted.... there is no domain

is it right ?

tfyl

joss
 
B

Benedikt Heinen

I am checking email addresses using RFC2822::EmailAddress

address =~ RFC2822::EmailAddress

seems to work fine, but I wonder why an email address like : me@somewhere is
accepeted.... there is no domain

is it right ?

it could still be 'me@somehost' - and as long as your mail service can
resolve that address, it's perfectly fine... When you perform the regexp
check therefore, this address is fine - the regexp check can't see whether
the user, host, or domain are valid - but the format is OK.




Benedikt

ALLIANCE, n. In international politics, the union of two thieves who
have their hands so deeply inserted in each other's pockets that
they cannot separately plunder a third.
(Ambrose Bierce, The Devil's Dictionary)
 
J

Josselin

it could still be 'me@somehost' - and as long as your mail service can
resolve that address, it's perfectly fine... When you perform the
regexp check therefore, this address is fine - the regexp check can't
see whether the user, host, or domain are valid - but the format is OK.




Benedikt

ALLIANCE, n. In international politics, the union of two thieves who
have their hands so deeply inserted in each other's pockets that
they cannot separately plunder a third.
(Ambrose Bierce, The Devil's Dictionary)

thanks a lot
 
D

Dominic Marks

...excuse me....but..how do i load this module or is it a constant???
dave

--
module RFC822
EmailAddress = begin
qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]'
dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]'
atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-' +
'\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+'
quoted_pair = '\\x5c[\\x00-\\x7f]'
domain_literal = "\\x5b(?:#{dtext}|#{quoted_pair})*\\x5d"
quoted_string = "\\x22(?:#{qtext}|#{quoted_pair})*\\x22"
domain_ref = atom
sub_domain = "(?:#{domain_ref}|#{domain_literal})"
word = "(?:#{atom}|#{quoted_string})"
domain = "#{sub_domain}(?:\\x2e#{sub_domain})*"
local_part = "#{word}(?:\\x2e#{word})*"
addr_spec = "#{local_part}\\x40#{domain}"
pattern = /\A#{addr_spec}\z/
end
end
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top