Skip to content

Instantly share code, notes, and snippets.

@orsenthil
Last active February 9, 2017 22:30
Show Gist options
  • Save orsenthil/19dacdaec1ee0e3206159f98e0db5bdb to your computer and use it in GitHub Desktop.
Save orsenthil/19dacdaec1ee0e3206159f98e0db5bdb to your computer and use it in GitHub Desktop.
import re
RE_PATTERNS = re.compile(r"(?:Issue ?)?#?(\d+)", flags=re.MULTILINE | re.IGNORECASE)
test_messages = [
"""#123""",
"""Issue #123""",
"""Issue#123""",
"""Issue123""",
"""Issue 123""",
"""Multiline
#1234
Issue1134""",
"""Multiline
Issue1234,
#12345,
Issue 12345"""
]
for message in test_messages:
print RE_PATTERNS.sub(r"bpo-\1", message)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment