Skip to content

Commit

Permalink
Add word boundaries to pattern-matching product name --autopull
Browse files Browse the repository at this point in the history
  • Loading branch information
angussidney committed Feb 27, 2017
1 parent 4417eab commit b497e89
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions findspam.py
Expand Up @@ -188,8 +188,8 @@ def pattern_product_name(s, site, *args):
"Xt?", "Alpha", "Prime", "Deep", "Male", "Pro", "Advanced", "Monster",
"Pure", "Skin", "Sea", "Muscle", "Ascend",
"Formula", "Serum", "Supplement", "Fuel", "Cream"])
three_words = regex.compile(ur"(?i)(({0})[ -]({0})[ -]({0}))".format(keywords)).findall(s)
two_words = regex.compile(ur"(?i)(({0})[ -]({0}))".format(keywords)).findall(s)
three_words = regex.compile(ur"(?i)\b(({0})[ -]({0})[ -]({0}))\b".format(keywords)).findall(s)
two_words = regex.compile(ur"(?i)\b(({0})[ -]({0}))\b".format(keywords)).findall(s)
if len(three_words) >= 1:
return True, u"Pattern-matching product name *{}*".format(three_words[0][0])
elif len(two_words) >= 2:
Expand Down

0 comments on commit b497e89

Please sign in to comment.