Results 1 to 3 of 3

Thread: ia any wrong above[validating email address Reqexp] ?

  1. #1
    Join Date
    Oct 2004
    Posts
    425
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default ia any wrong above[validating email address Reqexp] ?

    Code:
    (eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z\.]{2,4}", $email))
    ia any wrong above[validating email address Reqexp] ? the "_" may exist right-hand side of "@" ?

    addresses like
    a080725@cytanet.com.cy
    a080725@cytanet.depart.com.cy
    get true - passed ?

  2. #2
    Join Date
    Jul 2008
    Posts
    128
    Thanks
    0
    Thanked 17 Times in 16 Posts

    Default

    This regex is expressed as a string, presumably to be passed to a RegEx constructor, so the backslashes have to be escaped: \\

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by clueful View Post
    This regex is expressed as a string, presumably to be passed to a RegEx constructor, so the backslashes have to be escaped: \\
    Trick question (though you may still be correct, PHP isn't my strong point), eregi is one of the PHP regular expression constructors. This question probably belongs in the PHP forum, I'm moving it. If there are any valid objections, I will return it to the javascript forum.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •