Your silly email parser is not good enough

Read and weep. The originators of the internet have deemed this (RFC 5321, 5322) to be a valid email address:
Address:    <(!) "foo;bar,shar!" (woof """) @ (blah; zar, far) +-!~.example.com (???)>
Local part: <(!) "foo;bar,shar!" (woof """) >
Domain:     <+-!~.example.com>
Domain is VALID according to RFC 5322
The text inside parentheses are comments. Yes, our forefathers saw it fit to allow email addresses to contain comments. Maybe to include instructions for the postman.

The local part is preserved exactly as-is because of the following:
"Consequently, and due to a long history of problems when intermediate hosts have attempted to optimize transport by modifying them, the local-part MUST be interpreted and assigned semantics only by the host specified in the domain part of the address."
Detailed analysis of the address's structure:
Root at 1:1
  addr_spec at 1:1
    local_part at 1:1
      quoted_string at 1:1
        CFWS at 1:1
          comment at 1:1
            OpenBr at 1:1 - "("
            ccontent at 1:2
              ctext_word at 1:2 - "!"
            CloseBr at 1:3 - ")"
          FWS at 1:4 - " "
        DblQuote at 1:5 - "\""
        qs_content at 1:6
          qtext_word at 1:6 - "foo;bar,shar!"
        DblQuote at 1:19 - "\""
        CFWS at 1:20
          FWS at 1:20 - " "
          comment at 1:21
            OpenBr at 1:21 - "("
            ccontent at 1:22
              ctext_word at 1:22 - "woof"
            FWS at 1:26 - " "
            ccontent at 1:27
              ctext_word at 1:27 - "\"\"\""
            CloseBr at 1:30 - ")"
          FWS at 1:31 - " "
    At at 1:32 - "@"
    domain at 1:33
      CFWS at 1:33
        FWS at 1:33 - " "
        comment at 1:34
          OpenBr at 1:34 - "("
          ccontent at 1:35
            ctext_word at 1:35 - "blah;"
          FWS at 1:40 - " "
          ccontent at 1:41
            ctext_word at 1:41 - "zar,"
          FWS at 1:45 - " "
          ccontent at 1:46
            ctext_word at 1:46 - "far"
          CloseBr at 1:49 - ")"
        FWS at 1:50 - " "
      dot_atom_text at 1:51
        atext_word at 1:51 - "+-!~"
        Dot at 1:55 - "."
        atext_word at 1:56 - "example"
        Dot at 1:63 - "."
        atext_word at 1:64 - "com"
      CFWS at 1:67
        FWS at 1:67 - " "
        comment at 1:68
          OpenBr at 1:68 - "("
          ccontent at 1:69
            ctext_word at 1:69 - "???"
          CloseBr at 1:72 - ")"

Comments

Popular posts from this blog

When monospace fonts aren't: The Unicode character width nightmare

Circumcision as an adult, part 1

Circumcision as an adult, part 2