Skip to content

Instantly share code, notes, and snippets.

@ivanelson
Created July 17, 2013 21:09
Show Gist options
  • Save ivanelson/6024526 to your computer and use it in GitHub Desktop.
Save ivanelson/6024526 to your computer and use it in GitHub Desktop.
Regex for mail reply
found_id = None
if self.parameters.ticket_update and self.parameters.ticket_update_by_subject:
SUBJECT_RE = re.compile(r'^(?:(?:RE|AW|VS|SV|FW|FWD):\s*)+(.*)', re.IGNORECASE)
result = SUBJECT_RE.search(subject)
LOG = open("/tmp/regex.log", "a")
LOG.write("<<INICIO>>\n")
LOG.write("INICIO UPDATE_BY_SUBJECT: %s -> %s\n" % (subject.encode('utf8'), result))
LOG.close()
if result:
## This is a reply
#
orig_subject = result.group(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment