473,382 Members | 1,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Re: Parsing Email 'References' header.

On Thu, May 8, 2008 at 2:53 PM, Aspersieman <as*********@gmail.comwrote:
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:"<1@mail.gmail.com><2@mail.gmail.com><3@mail.gm ail.com><4@mail.gmail.com><5@mail.gmail.com>"
lastmesgid = "".join( filter( rx_lastmesgid.match, parentid ) )
</code>

I need it to return "<5@mail.gmail.com>"

Can anyone help?
"<.*>(<.*?>)"
Jun 27 '08 #1
0 1056

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Omkar Singh | last post by:
I try to parse a XML document containg some references using XmlDocument Class' method GetElementbyTagName. It just give the content between starting tagName and ending tagName but not all...
9
by: Omkar Singh | last post by:
I try to parse a XML document containg some references using XmlDocument Class' method GetElementbyTagName. It just give the content between starting tagName and ending tagName but not all...
0
by: Aspersieman | last post by:
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...
0
by: J. Cliff Dyer | last post by:
On Thu, 2008-05-08 at 14:53 +0200, Aspersieman wrote: Forget regular expressions. py>>lastmesgid = '<' + parentid.split('<')
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.