Skip to content

Commit

Permalink
Fix regex to offer a bit more flexibility.
Browse files Browse the repository at this point in the history
Suggested by @Taaku18
  • Loading branch information
Jerrie-Aries committed Nov 1, 2021
1 parent 219ef56 commit 7be70c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ def cleanup_code(content: str) -> str:


TOPIC_REGEX = re.compile(
r"\b(Title: (?P<title>.*)\n)?"
r"(?:\bTitle:\s*(?P<title>.*)\n)?"
r"\bUser ID:\s*(?P<user_id>\d{17,21})\b"
r"(\nOther Recipients:\s*(?P<other_ids>(\d{17,21},?)+))?",
r"(?:\nOther Recipients:\s*(?P<other_ids>\d{17,21}(?:(?:\s*,\s*)\d{17,21})*)\b)?",
flags=re.IGNORECASE | re.DOTALL,
)
UID_REGEX = re.compile(r"\bUser ID:\s*(\d{17,21})\b", flags=re.IGNORECASE)
Expand Down

0 comments on commit 7be70c0

Please sign in to comment.