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())
aW1wb3J0IHJlCnJlZ2V4ID0gciIoPzouKig/OlxyP1xuKSspezJ9YWdlKD86LiooPzpccj9cbnwkKSspezN9Igp0ZXN0X3N0ciA9ICgiIFByYXRhcFxuIgogICAgInBhbmRleVxuIgogICAgImFnZVxuIgogICAgIjI1XG4iCiAgICAic3R1ZGVudCIpCgptYXRjaGVzID0gcmUuZmluZGl0ZXIocmVnZXgsIHRlc3Rfc3RyLCByZS5NVUxUSUxJTkUpCmZvciBtYXRjaCBpbiBtYXRjaGVzOgogICAgcHJpbnQgKG1hdGNoLmdyb3VwKCkp