Skip to content

Instantly share code, notes, and snippets.

@tangentstorm
Created November 9, 2012 11:22
Show Gist options
  • Save tangentstorm/4045219 to your computer and use it in GitHub Desktop.
Save tangentstorm/4045219 to your computer and use it in GitHub Desktop.
imap regexp example for timg
>>> import re
>>> data = ['2 (X-GM-THRID 1391221299548167514 X-GM-MSGID 1391221299548167514 UID 6)']
>>> re.search('X-GM-THRID (?P<X_GM_THRID>\d+) X-GM-MSGID (?P<X_GM_MSGID>\d+)', data[0]).groupdict()
{'X_GM_THRID': '1391221299548167514', 'X_GM_MSGID': '1391221299548167514'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment