Oh! yes you can use re for that. You just need to change the pattern a bit I did not understand where the "title" will be so I have ignored it, but I got something below which will be helpful for you
>>> value = """name:asasasasas\nrequest: play\ntitle""" >>> reg = re.compile('Name:.*\\nrequest:.....', re.IGNORECASE) >>> re.findall(reg, value) ['name:asasasasas\nrequest: play'] >>> value2 = """name:asasasasas\nrequest: next\ntitle""" >>> reg = re.compile('Name:.*\\nrequest:.....', re.IGNORECASE) >>> re.findall(reg, value2) ['name:asasasasas\nrequest: next'] >>> -- http://mail.python.org/mailman/listinfo/python-list