Skip to content

Commit

Permalink
Fix 'escape character invalid' warning on Travis
Browse files Browse the repository at this point in the history
Regex patterns and escape chars, unless in a string prepended by 'r' before it to indicate a regex, explodes with an invalid escape character warning.
  • Loading branch information
teward committed Apr 21, 2017
1 parent 685b05b commit 5911606
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion findspam.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def pattern_product_name(s, site, *args):
"Pure", "Skin", "Sea", "Muscle", "Ascend", "Youth", "Hyper(tone)?", "Hydroluxe", "Booster",
"Serum", "Supplement", "Fuel", "Cream"]
if site != "math.stackexchange.com" and site != "mathoverflow.net":
keywords += ["E?X[tl\d]?", "Alpha", "Plus", "Prime", "Formula"]
keywords += [r"E?X[tl\d]?", "Alpha", "Plus", "Prime", "Formula"]
keywords = "|".join(keywords)
three_words = regex.compile(r"(?i)\b(({0})[ -]({0})[ -]({0}))\b".format(keywords)).findall(s)
two_words = regex.compile(r"(?i)\b(({0})[ -]({0}))\b".format(keywords)).findall(s)
Expand Down

0 comments on commit 5911606

Please sign in to comment.