SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    VICTORY IS MINE! luchazard's Avatar
    Join Date
    May 2001
    Location
    USA
    Posts
    229
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    hmm... email validator question

    I have this code:
    PHP Code:
    if (!ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.
    '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$'$recip_email) || ereg("'"$recip_email)) 
    And I know the first part validtates $recip_email but why is
    PHP Code:
     || ereg("'"$recip_email)) 
    put in there??? Do I really need it, what exactly does that do? THANKS!

  2. #2
    Grumpy Mole Man Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,067
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    At a guess (because reading other people's regular expressions is about as much fun as wading in raw sewage) that's just an extra thing chucked on to ensure that the email address you are checking doesn't have any single quotes in it, single quotes being an illegal character in email addresses. I'm not sure why that isn't dealt with in the rest of the regexp though - that is one uuuugly regular expression...

  3. #3
    VICTORY IS MINE! luchazard's Avatar
    Join Date
    May 2001
    Location
    USA
    Posts
    229
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Skunk, so you have a better one? I want one thats not that long and huge but is really good... anyone know the best code to validate emails, then post here


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •