Re: help with parsing email

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gabriel Genellina

    Re: help with parsing email

    En Thu, 14 Aug 2008 12:50:57 -0300, Ahmed, Shakir <shahmed@sfwmd. govescribió:
    I need to grab/parse numeric numbers such as app number from incoming
    emails stored in Microsoft Outlook (Microsoft Exchange server) with
    specified subject line.
    >
    The email body is like this
    >
    myregion ; tst ; 11-Aug-2008
    >

    >
    I need to extract 080612-21_ number from above line from incoming
    emails.
    I can't help with the part dealing with Outlook - but once you retrieved the email body, it's easy:

    import re
    re_number = re.compile(r"No ticeOfapplicati on/([0-9-_]+)")
    match = re_number.searc h(body)
    if match:
    print match.group(1)

    (this matches any numbers plus "-" and "_" after the words NoticeOfapplica tion written exactly that way)

    --
    Gabriel Genellina

Working...