1. stick a scissor in you eye
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2004
    Pensacola, Florida
    Rep Power

    Email validation ALIEN code

    I would like a deeper understanding of email-validation. Specifically with the ALIEN-like string we run against user, and host in email addresses. "/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`{|}-]+" for example. This string is used against the 'user' section of our email addresses.

    All of the information I have found on email validation just takes pre-existing examples of this for granted, and offer to explanation for what this actually means. Can anybody here decypher this insane garble so I can have a better understanding as to what is actually taking place? I am not just a 'copy, paste, good - now the job is done." I want a deeper understanding Call me old-fashioned!


    Comments on this post

    • jharnois agrees : rep++ for wanting to understand your code
    • kicken agrees : ^^
  2. #2
  3. mod_dev_shed
    Devshed Supreme Being (6500+ posts)

    Join Date
    Sep 2002
    Atlanta, GA
    Rep Power
    By user section I assume you mean foo in foo@domain.com? No matter really, I guess. I can tell you the literal equivalent for this regular expression, but w/o seeing it in context it's hard to say exactly how it's used.

    " begin string
    / begin pattern (there should be a matching / at the end of the pattern)
    ^ match starting at the beginning of the searched string
    [ begin a character class; a set of characters
    -!#$%&\'*+\\.\/0-9=?A-Z^_`{|}- these characters literally, \\ is an escaped \, \/ is an escaped / (which is required so the interpreter doesn't think it's the end of the pattern), 0-9 is all numbers, A-Z is all upper case letters
    ] ends the character class
    + means to match one of the characters in the preceeding character class at least once, or "one or more times"
    " ends string

    Comments on this post

    • jsampsonPC agrees : Amazing insight into some of the deepest levels of nonsense that I have ever seen. I mean that as a compliment too. Jeremy, you blew my mind when you answered my ALIEN-validation question(s). Thank you, and kudos to your desire to feed on knowledge.
    # Jeremy

    Explain your problem instead of asking how to do what you decided was the solution.

IMN logo majestic logo threadwatch logo seochat tools logo