I\'m trying to extract email addresses from plain text transcripts of emails. I\'ve cobbled together a bit of code to find the addresses themselves, but I don\'t know how to mak
"[stuff]@[stuff][stuff1-4 letters]" is about right, but if you wanted to you could decode the regular expression using a trick I just found out about, here. Do the compile() in an interactive Python session like this:
mailsrch = re.compile(r'[\w\-][\w\-\.]+@[\w\-][\w\-\.]+[a-zA-Z]{1,4}', 128)
It will print out the following:
in
category category_word
literal 45
max_repeat 1 65535
in
category category_word
literal 45
literal 46
literal 64
in
category category_word
literal 45
max_repeat 1 65535
in
category category_word
literal 45
literal 46
max_repeat 1 4
in
range (97, 122)
range (65, 90)
Which, if you can kind of get used to it, shows you exactly how the RE works.