Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Simple regexp in python working on a string of names and e-mail adresses

Simple regexp in python working on a string of names and e-mail adresses

#!/usr/bin/env python

import re
import sys

mySplit = re.compile (r',', flags=re.MULTILINE)
mailadress = re.compile (r'\<.\D*.\D+@\D+.[.]\D+.\>', flags=re.MULTILINE)

for i in mySplit.split ("Weng Feng <weng.feng@telia.se>, Erik Andersson <kirean@gmail.com>, Ake Kong <kong@\
goek.se>"):
    k = mailadress.search(i.strip())
    if k:
        print k.group().lstrip("<").rstrip(">")

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS