Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Jul 08, 2010 @ 08:54
    Sebastiaan Janssen
    0

    Email validation improvement suggestion

    Hey Tim, I've seen this before in other packages you've created, the regex you use to validate e-mail addresses is much too limiting. I was testing uCommerce and entered an e-mail address like [email protected] but it got rejected for some reason. Then I tested [email protected] and it also got rejected. 

    The second rejection is actually supposed to happen for the regex that is in there, but this is a completely valid e-mail address according to the official RFC 2822 standard. Gmail uses this notation so you can have aliasses ([email protected] and [email protected] will both go to [email protected]).

    The first rejection is a bit of a riddle to me though, the regex should validate this address just fine! As soon as I changed the regex to the one below, the comments went through though...

    This regex comes from this article, which shows different expressions to validate an e-mail address and I've found that the last one in the article works great.

    [a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
  • davelane 29 posts 73 karma points
    Jul 17, 2010 @ 16:50
    davelane
    1

    I would also love to see this improvement made to the uComment package.  Any chance that an update will be made soon?  It's a great package!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies