Skip to content

fix: use raw strings for regex patterns with escaped brackets#70

Open
AmSach wants to merge 1 commit into
wustho:masterfrom
AmSach:fix/raw-string-regex
Open

fix: use raw strings for regex patterns with escaped brackets#70
AmSach wants to merge 1 commit into
wustho:masterfrom
AmSach:fix/raw-string-regex

Conversation

@AmSach

@AmSach AmSach commented May 18, 2026

Copy link
Copy Markdown

Fixed SyntaxWarnings for invalid escape sequences in regex patterns. Two regex patterns with escaped square brackets were using regular strings instead of raw strings, causing DeprecationWarning in Python 3.12+.

Before:

re.search("\[IMG:[0-9]+\]", i)
re.search("(?<=\[IMG:)[0-9]+(?=\])", i)

After:

re.search(r"\[IMG:[0-9]+\]", i)
re.search(r"(?<=\[IMG:)[0-9]+(?=\])", i)

Added r prefix to make them raw strings, eliminating the deprecation warnings. — Sent via @AmSach bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant