import re
data = """sentence one.
sentence two.
a bad sentence
sentence three.
sentence four."""
print(re.findall('^.*\\.$', data, re.MULTILINE))
print(re.findall('\\A^.*\\.$', data, re.MULTILINE))
print(re.findall('^.*\\.$\\Z', data, re.MULTILINE))
Match start and end of file in python with regex