Examples > E-mail address > Syntax specification
Following syntax specification can be found in the book: J.E.F. Friedl: Reguläre Ausdrücke, O'Reilly, 1998.
|
Element
|
Description
|
1
|
mailbox
|
addr-spez | phrase route-addr
|
2
|
addr-spec
|
local-part @ domain
|
3
|
phrase
|
( word )+
|
4
|
route-addr
|
< ( route )? addr-spez >
|
5
|
local-part
|
word (. word)*
|
6
|
domain
|
sub-domain (. sub-domain )*
|
7
|
word
|
atom | quoted-string
|
8
|
route
|
@ domain (, @ domain )* :
|
9
|
sub-domain
|
domain-ref | domain-literal
|
10
|
atom
|
( a character except specials, space or ctl )+
|
11
|
quoted-string
|
" ( qtext | quoted-pair )* "
|
12
|
domain-ref
|
atom
|
13
|
domain-literal
|
( dtext | quoted-pair )*
|
14
|
char
|
An ASCII character (octal 000-177)
|
15
|
ctl
|
An ASCII control character (octal 000-037)
|
16
|
space
|
Space (ASCII 040)
|
17
|
CR
|
Carriage Return (ASCII 015)
|
18
|
specials
|
One of the characters ()<>@,;:\\"\.\[\]
|
19
|
qtext
|
A char except *, \ or CR
|
20
|
dtext
|
A char except [, ], \ or CR
|
21
|
quoted -pair
|
\ char
|
|
|
|
22
|
comment
|
( (ctext | quoted-pair | comment )* )
|
23
|
ctext
|
A char except '(', ')', '\' or CR
|
From this specification Friedl constructs a single regular expression consisting in 4724 characters. The following reconstruction of this grammar in the TextTransformer has approximately the length of specification itself.
|