Thread: Suggestions

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2008
    Posts
    28
    Rep Power
    0

    Suggestions


    Hello all

    i started learning regex yesterday as part of my revision, and am surprised how quickly i picked up the basics

    this is my attempt at an email validation (i saw the RFC822 full page jobby and was in awe)

    Code:
     ^[A-Za-z]+[\w\-\.]*\@[a-zA-Z]*\.([a-z]{2,4}| [a-z]{2}\.[a-z]{2})+$
    and am struggling with the last co.uk bit can anybody see what it missing

    also any hints and tips to make me a better REGEX'er

    Thanks for your help
    Jon
  2. #2
  3. No Profile Picture
    User 165270
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2005
    Posts
    497
    Rep Power
    937
    This article is about using regex to validate e-mail addresses:
    http://www.regular-expressions.info/email.html
  4. #3
  5. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,997
    Rep Power
    9397
    As for an explanation rather than just a link that doesn't help the actual question,
    Code:
    ([a-z]{2,4}| [a-z]{2}\.[a-z]{2})+$
    There's a space in there that shouldn't be.

    Comments on this post

    • prometheuzz disagrees : What's it called again... Yeah, voting it down. ; )
    Last edited by requinix; March 7th, 2009 at 05:41 PM.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2008
    Posts
    28
    Rep Power
    0
    amazing thank you,

    somthing soo simple but until your told :P

    thanks for the help
    Jon
  8. #5
  9. No Profile Picture
    User 165270
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2005
    Posts
    497
    Rep Power
    937
    Originally Posted by requinix
    As for an explanation rather than just a link that doesn't help the actual question,
    ...
    Perhaps it doesn't help the actual question, but it is an excellent article. Note that the OP also asked for general hints and tip to become better at regex: that website is one of the better on-line sources there are.

IMN logo majestic logo threadwatch logo seochat tools logo