using regex to pull out email addresses

Discussion in 'Python' started by Kun, Mar 25, 2006.

  1. Kun

    Kun Guest

    i have a regular expression that searches a string and plucks out email
    addresses however it doesn't work for email addresses w/a subdomain e.g.



    emails = re.findall('(\w+@\w+\.\w+)', senderlist) <-- my code


    is there any way to modify that to include email addresses that also
    have subdomains?
    Kun, Mar 25, 2006
    #1
    1. Advertising

  2. Kun

    Arne Ludwig Guest

    >>> senderlist="na nu hu ji@ja fa hu"
    >>> print [ s[0] for s in re.findall("(\w+@(\w+\.)+\w+)",senderlist) ]

    ['', '']
    Arne Ludwig, Mar 25, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kelly
    Replies:
    1
    Views:
    406
    The Durban Towel
    Apr 28, 2004
  2. Replies:
    2
    Views:
    2,146
    Mike Treseler
    Jun 28, 2006
  3. namespace1
    Replies:
    3
    Views:
    882
  4. Kenshin
    Replies:
    1
    Views:
    211
    Jeff Cochran
    Jun 25, 2004
  5. Doug Wells
    Replies:
    4
    Views:
    155
    Tore Aursand
    Jan 27, 2005
Loading...

Share This Page