# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"[A-Z][a-z]+\s+[A-Z][a-z]+"
test_str = ("\n"
"
\n"
"\n"
"Lorem Ipsum dolor Sit amet |
\n"
"Consectetuer adipiscing elit |
\n"
"Aliquam Tincidunt mauris eu Risus |
\n"
"Vestibulum Auctor Dapibus neque |
\n"
"
\n"
"\n"
"\n"
"\"\"\"")
matches = re.finditer(regex, test_str, re.MULTILINE)
for matchNum, match in enumerate(matches):
matchNum = matchNum + 1
print (match.group())
# Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.