Use 're.IGNORECASE' flag instead of 'lower()' string method

master
Dan Howe 7 years ago
parent 6d2d7e3a41
commit e75641c700

@ -87,7 +87,7 @@ def search_pdf(pdf_name, search_patterns, context_length):
for pattern in search_patterns: for pattern in search_patterns:
if pattern == pattern.lower(): if pattern == pattern.lower():
# Ignore case if pattern is all lowercase # Ignore case if pattern is all lowercase
matches = re.finditer(pattern, page_text.lower()) matches = re.finditer(pattern, page_text, re.IGNORECASE)
else: else:
# Respect case if pattern is mixed or uppercase # Respect case if pattern is mixed or uppercase
matches = re.finditer(pattern, page_text) matches = re.finditer(pattern, page_text)

Loading…
Cancel
Save