Re: rfc2822 compliant email pattern?
David Tolpin <[email protected]>
| Newsgroups | gmane.text.xml.relaxng.general |
|---|---|
| Message-ID | <[email protected]> |
> Is it possible to write a pattern for an email address please? > > [email protected] > [email protected] > > tia. DaveP Dave, if you need a regular expression for addr-spec, then it is start=element addr-spec { xsd:token { pattern="""([a-zA-Z0-9!#$%&'*+\-/=?\^_`{|}~]+(\.[a-zA-Z0-9!#$%&'*+\-/=?\^_`{|}~]+)*|"[^"\\]*")@([a-zA-Z0-9!#$%&'*+\-/=?\^_`{|}~]+(\.[a-zA-Z0-9!#$%&'*+\-/=?\^_`{|}~]+)*|\[[^\[\]\\]*\])""" } } Works for both normal addresses and forms like "David Tolpin"@[Obscure Place] The expression above is slightly more allowing than required, but should be appropriate for the majority of cases. David