Skip to content

Commit 7be70c0

Browse files
committed
Fix regex to offer a bit more flexibility.
Suggested by @Taaku18
1 parent 219ef56 commit 7be70c0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,9 @@ def cleanup_code(content: str) -> str:
221221

222222

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

0 commit comments

Comments
 (0)