This should give you an idea of how to go about it (needs python 2.3 or newer):
import re slashPattern = re.compile(r'\\(.*?)\\') for i,line in enumerate(file("parseinput")): print "line", i+1, match = slashPattern.search(line) if match: print "matched:", match.group(1) else: print "did not match" #===== output ======================= line 1 matched: 'di_--v*-.ga_-t line 2 matched: 'pas-*m #==================================== George -- http://mail.python.org/mailman/listinfo/python-list