in reply to Re: Help
in thread How to check CGI params in if/elsif

> I also notice that your E-Mail test would fail with any domain that has more than two parts ..
Wrong, it would match because there is no anchor at the and of the regex. But the test is really bad anyway ...

> Suffice to say that it's impossible to write a regexp that parses E-Mail addresses.
See Jeffrey Friedl's regex that checks if an email address conforms to rfc822 published in Mastering Regular Expressions. IIRC that regex is about 6k characters long, it is also included in the module Email::Valid which I would recommend for checking email addresses.

cheers,
snowcrash

Replies are listed 'Best First'.
Re: Re: Re: Help
by talexb (Chancellor) on Jun 11, 2002 at 12:51 UTC
      > Suffice to say that it's impossible to write a regexp that parses E-Mail addresses.
      See Jeffrey Friedl's regex that checks if an email address conforms to rfc822 published in Mastering Regular Expressions. IIRC that regex is about 6k characters long, it is also included in the module Email::Valid which I would recommend for checking email addresses.
    Right, well of course, what I was implying was that it's impossible to write a *short* regexp that will accurately parse for a valid E-Mail address. Anything's impossible with enough code and horsepower to run it.

    I still maintain that in the context (code size, inferred experience level) of the original message, such a regexp is impossible.

    --t. alex

    "Nyahhh (munch, munch) What's up, Doc?" --Bugs Bunny