import re
regex = r"(?:.*(?:\r?\n)+){2}age(?:.*(?:\r?\n|$)+){3}"
test_str = (" Pratap\n"
    "pandey\n"
    "age\n"
    "25\n"
    "student")

matches = re.finditer(regex, test_str, re.MULTILINE)
for match in matches:
    print (match.group())