Ahem A Rivet's Shot writes:
> The Natural Philosopher wrote:
>> On 19/03/2020 13:18, Martin Gregorie wrote:
>> > So, can any of you do better, i.e. write a regex that CAN validate the
>> > syntax of an e-mail address in terms of its structure and the set of
>> > permitted characters on the username and domain parts (the permitted
>> > character sets are not the same).
>> No. That's why I don't bother with regex, ever.
>
> In this case regex is not the problem, the problem is that email
> addresses are not designed to be parsed.
Yes, they are designed to be parsed and parsers for them exist (for
instance in most email software). The specifications have always
contained grammars for them. The language specified in RFC822 isn’t a
regular language, but that just means you need something a little more
sophisticated than a regular expression to parse it.
--
https://www.greenend.org.uk/rjk/
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|