diff --git a/patacrep/authors.py b/patacrep/authors.py index 94e07f92..a451859f 100644 --- a/patacrep/authors.py +++ b/patacrep/authors.py @@ -23,11 +23,11 @@ def compile_authwords(authwords): # Compilation authwords['after'] = [ - re.compile(r"^.*%s\b(.*)" % word) + re.compile(r"^.*\b%s\b(.*)$" % word, re.LOCALE) for word in authwords['after'] ] authwords['sep'] = [ - re.compile(r"^(.*)%s (.*)$" % word) + re.compile(r"^(.*)%s +(.*)$" % word, re.LOCALE) for word in ([" %s" % word for word in authwords['sep']] + [',']) ] diff --git a/patacrep/index.py b/patacrep/index.py index cd83668e..9ee5e99d 100755 --- a/patacrep/index.py +++ b/patacrep/index.py @@ -19,8 +19,8 @@ from patacrep.plastex import simpleparse EOL = u"\n" # Pattern set to ignore latex command in title prefix -KEYWORD_PATTERN = re.compile(r"^%(\w+)\s?(.*)$") -FIRST_LETTER_PATTERN = re.compile(r"^(?:\{?\\\w+\}?)*[^\w]*(\w)") +KEYWORD_PATTERN = re.compile(r"^%(\w+)\s?(.*)$", re.LOCALE) +FIRST_LETTER_PATTERN = re.compile(r"^(?:\{?\\\w+\}?)*[^\w]*(\w)", re.LOCALE) def sortkey(value): @@ -98,7 +98,8 @@ class Index(object): if 'prefix' in self.keywords: for prefix in self.keywords['prefix']: self.prefix_patterns.append(re.compile( - r"^({prefix})(\b|\\)(\s*.*)$".format(prefix=prefix) + r"^({prefix})(\b|\\)(\s*.*)$".format(prefix=prefix), + re.LOCALE )) if self.indextype == "AUTHOR": diff --git a/patacrep/songs.py b/patacrep/songs.py index 66ea2ad2..d62cbe64 100755 --- a/patacrep/songs.py +++ b/patacrep/songs.py @@ -43,7 +43,7 @@ def unprefixed_title(title, prefixes): """Remove the first prefix of the list in the beginning of title (if any). """ for prefix in prefixes: - match = re.compile(r"^(%s)\b\s*(.*)$" % prefix).match(title) + match = re.compile(r"^(%s)\b\s*(.*)$" % prefix, re.LOCALE).match(title) if match: return match.group(2) return title