diff --git a/walrus/autocomplete.py b/walrus/autocomplete.py index 9732b84..4dba1cc 100644 --- a/walrus/autocomplete.py +++ b/walrus/autocomplete.py @@ -57,7 +57,7 @@ def _load_stopwords(self): def tokenize_title(self, phrase, stopwords=True): if isinstance(phrase, bytes): phrase = decode(phrase) - phrase = re.sub('[^a-z0-9_\-\s]', '', phrase.lower()) + phrase = re.sub(r'[^a-z0-9_\-\s]', '', phrase.lower()) if stopwords and self._stopwords: return [w for w in phrase.split() if w not in self._stopwords] else: diff --git a/walrus/search/__init__.py b/walrus/search/__init__.py index f565cc1..9484154 100644 --- a/walrus/search/__init__.py +++ b/walrus/search/__init__.py @@ -13,7 +13,7 @@ def __init__(self, stemmer=True, metaphone=False, self._use_metaphone = metaphone self._min_word_length = min_word_length self._symbols_re = re.compile( - '[\.,;:"\'\\/!@#\$%\?\*\(\)\-=+\[\]\{\}_]') + r'[\.,;:"\'\\/!@#\$%\?\*\(\)\-=+\[\]\{\}_]') self._stopwords = self._load_stopwords(stopwords_file)