[relaxng-user] rfc2822 compliant email pattern?

David Tolpin dvd at davidashen.net
Sat Jan 17 00:39:05 ICT 2004


John,

let's not start it.

> (?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
> )+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:
> \r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(
> ?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ 

t is not XML Schema Datatypes Regular  Expressions, which is the only regex
syntax usable with Relax NG today (and tomorrow, I'm afraid).

Besides, a fair amount of this regular expression deals with white space.
Meanwhile, XML Schema Datatypes provides xsd:token datatype, which normalizes
whitespace. If the whitespace expressions were removed or reduced to ' ?', it
would become so much smaller.

I think that, for practical purposes, the expression for addr-spec, with spaces
inserted between parts, if required, is sufficient.

David Tolpin http://davidashen.net/


More information about the relaxng-user mailing list