1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Quick regexp question

Discussion in 'General Scripting Chat' started by itorch, Mar 7, 2013.

  1. itorch

    itorch Newbie

    Joined:
    Mar 6, 2013
    Messages:
    8
    Likes Received:
    1
    I have got my script searching for urls now I also want to add finding email addresses how can I do that?
     
  2. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,494
    Likes Received:
    10,313
    This is the regex for email addresses:

    Code:
    (?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
    
     
    • Thanks Thanks x 1
  3. gaabrielz

    gaabrielz Registered Member

    Joined:
    Nov 17, 2008
    Messages:
    60
    Likes Received:
    35
    Gender:
    Male
    Occupation:
    Developer
    Location:
    Canada
    Wow jazzc, that is a really complete one!
     
    • Thanks Thanks x 1
  4. itorch

    itorch Newbie

    Joined:
    Mar 6, 2013
    Messages:
    8
    Likes Received:
    1
    Thank you so much!