Modify re.match usage in scripts directory.

This commit is contained in:
George Edward Bulmer 2017-12-11 23:06:52 +00:00
parent 747a9bc5b6
commit f74832328f
3 changed files with 5 additions and 5 deletions

View File

@ -154,17 +154,17 @@ class AsciiDoc:
hidden = False
elif line == "The Compiler <mail@qutebrowser.org>\n":
continue
elif re.match(r'^:\w+:.*', line):
elif re.fullmatch(r':\w+:.*', line):
# asciidoc field
continue
if not found_title:
if re.match(r'^=+$', line):
if re.fullmatch(r'=+', line):
line = line.replace('=', '-')
found_title = True
title = last_line.rstrip('\n') + " | qutebrowser\n"
title += "=" * (len(title) - 1)
elif re.match(r'^= .+', line):
elif re.fullmatch(r'= .+', line):
line = '==' + line[1:]
found_title = True
title = last_line.rstrip('\n') + " | qutebrowser\n"

View File

@ -132,7 +132,7 @@ def filter_func(item):
True if the missing function should be filtered/ignored, False
otherwise.
"""
return bool(re.match(r'[a-z]+[A-Z][a-zA-Z]+', item.name))
return bool(re.fullmatch(r'[a-z]+[A-Z][a-zA-Z]+', item.name))
def report(items):

View File

@ -142,7 +142,7 @@ def parse_entry(entry):
dict_re = re.compile(r"""
(?P<filename>(?P<code>[a-z]{2}(-[A-Z]{2})?).*)\.bdic
""", re.VERBOSE)
match = dict_re.match(entry['name'])
match = dict_re.fullmatch(entry['name'])
if match is not None:
return match.group('code'), match.group('filename')
else: