Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

•Re^2: Please evaluate: RegEx for validating e-mail addresses

by merlyn (Sage)
on Sep 25, 2004 at 20:28 UTC ( #393844=note: print w/ replies, xml ) Need Help??


in reply to Re: Please evaluate: RegEx for validating e-mail addresses
in thread Please evaluate: RegEx for validating e-mail addresses

If you want to see how that regex was built, buy the MRE book. If you're just making toys to decorate your cubicle walls, fine. But if you're truly setting up a web page for general people to visit from other places, you must permit the RFC-permitted addresses. And the regex for that is the longish thing that Ovid posted. Nothing less.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.


Comment on •Re^2: Please evaluate: RegEx for validating e-mail addresses
Re^3: Please evaluate: RegEx for validating e-mail addresses
by FoxtrotUniform (Prior) on Sep 25, 2004 at 20:40 UTC

    I've only spent a few minutes looking for it, but my 2nd-edition Mastering Regular Expressions doesn't seem to include that regex. So I can't check my suspicion that the original MRE regex didn't actually match all RFC822 addresses, just most of them - I vaguely remember a disclaimer about comments in hostnames not being recognized, or some such. (Probably something recursive, now that I think about it.) Even Ovid's monstrous regex may not be complete.

    --
    F o x t r o t U n i f o r m
    Found a typo in this node? /msg me
    % man 3 strfry

      Yes, you remember almost correctly! The problem is nested comments. The oft-quoted monster regex deals with all comments, but no nested comments. Nested comments are impossible without resorting to trickery (a regex that only Perl could do because it has embedded Perl code).

      -- Randal L. Schwartz, Perl hacker
      Be sure to read my standard disclaimer if this is a reply.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://393844]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (17)
As of 2014-07-29 17:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (225 votes), past polls