Hi

I have a python script that parses email headers to extract information from them. I need to get the _last_ messageid in the 'References' field (http://cr.yp.to/immhf/thread.html) to create a threaded view of these emails (these messageid's are stored in a database).

Now, I can easily access the 'References' field using the python 'email' module, but I need a regular expression to get the last messageid in the 'References' field.

Here's what I have so far:
<code>
rx_lastmesgid = re.compile(r"(<.+>$)")
lastmesgid = "".join( filter( rx_lastmesgid.match, parentid ) ) # parentid's value is eg:"<[EMAIL PROTECTED]><[EMAIL PROTECTED]><[EMAIL PROTECTED]><[EMAIL PROTECTED]><[EMAIL PROTECTED]>"
lastmesgid = "".join( filter( rx_lastmesgid.match, parentid ) )
</code>

I need it to return "<[EMAIL PROTECTED]>"

Can anyone help?

Thanks

Nicol

--

The three things to remember about Llamas:
1) They are harmless
2) They are deadly
3) They are made of lava, and thus nice to cuddle.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to