# http://stackoverflow.com/q/28353897/5290909
import re
text = "A\nB"
print("Text: '%s'\n---" % text)
patterns = [ "a", "a(?i)", "A.*B", "A(?s).*B", "A.*(?s)B"]
for p in patterns:
match = re.search( p, text)
print("Pattern: '%s'\t\tMatch: %s" % (p, match.span() if match else None))
IyBodHRwOi8vc3RhY2tvdmVyZmxvdy5jb20vcS8yODM1Mzg5Ny81MjkwOTA5CmltcG9ydCByZQoKdGV4dCA9ICJBXG5CIgpwcmludCgiVGV4dDogJyVzJ1xuLS0tIiAlIHRleHQpCnBhdHRlcm5zID0gWyAiYSIsICJhKD9pKSIsICJBLipCIiwgIkEoP3MpLipCIiwgIkEuKig/cylCIl0KCmZvciBwIGluIHBhdHRlcm5zOgogICAgbWF0Y2ggPSByZS5zZWFyY2goIHAsIHRleHQpCiAgICBwcmludCgiUGF0dGVybjogJyVzJ1x0XHRNYXRjaDogJXMiICUgKHAsIG1hdGNoLnNwYW4oKSBpZiBtYXRjaCBlbHNlIE5vbmUpKQ==