でってゅー
メールアドレスの全体は正規言語じゃないってゅー。
コメントなんて使ったことないけど。
;; RFC 2822 (Internet Message Format) から addr-spec = local-part "@" domain local-part = dot-atom / quoted-string / obs-local-part domain = dot-atom / domain-literal / obs-domain domain-literal = [CFWS] "[" *([FWS] dcontent) [FWS] "]" [CFWS] dcontent = dtext / quoted-pair dtext = NO-WS-CTL / %d33-90 / %d94-126 ; [, ], \ を除く文字 dot-atom = [CFWS] dot-atom-text [CFWS] dot-atom-text = 1*atext *("." 1*atext) atext = ALPHA / DIGIT / "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "/" / "=" / "?" / "^" / "_" / "`" / "{" / "|" / "}" / "~" atom = [CFWS] 1*atext [CFWS] word = atom / quoted-string quoted-string = [CFWS] DQUOTE *([FWS] qcontent) [FWS] DQUOTE [CFWS] qcontent = qtext / quoted-pair qtext = NO-WS-CTL / %d33 / %d35-91 / %d93-126 ; ", \ を除く文字 quoted-pair = ("\" text) / obs-qp text = %d1-9 / %d11 / %d12 / %d14-127 / ; NUL, CR, LF 以外 obs-text NO-WS-CTL = %d1-8 / %d11 / %d12 / %d14-31 / %d127 ; CR, LF, space を除く制御文字 FWS = ([*WSP CRLF] 1*WSP) / obs-FWS ; Folding White Space CFWS = *([FWS] comment) (([FWS] comment) / FWS) comment = "(" *([FWS] ccontent) [FWS] ")" ccontent = ctext / quoted-pair / comment ctext = NO-WS-CTL / %d33-39 / %d42-91 / %d93-126 ; (, ), \ を除く文字 obs-local-part = word *("." word) obs-domain = atom *("." atom) obs-qp = "\" (%d0-127) obs-text = *LF *CR *(obs-char *LF *CR) obs-char = %d0-9 / %d11 / %d12 / %d14-127 ; CR, LF 以外 obs-FWS = 1*WSP *(CRLF 1*WSP) ;; RFC 2234 (Augmented BNF for Syntax Specifications) から SP = %x20 HTAB = %x09 DQUOTE = %x22 WSP = SP / HTAB ALPHA = %x41-5A / %x61-7A ; A-Z, a-z DIGIT = %x30-39 ; 0-9 CRLF = %d13.10
Comments may nest.