Greg Lindstrom wrote: > I have a file generated by an HP-9000 running Unix containing form feeds > signified by ^M^L. I am > trying to scan for the linefeed to signal certain processing to be performed > but can not get the > regex to "see" it. Suppose I read my input line into a variable named "input" > > The following does not seem to work... > input = input_file.readline() > if re.match('\f', input): print 'Found a formfeed!' > else: print 'No linefeed!'
hint: >>> line = "\r\f" >>> re.match("\f", line) (nothing) >>> re.search("\f", line) <_sre.SRE_Match object at 0x00B380C8> >>> re.match("\r\f", line) <_sre.SRE_Match object at 0x00B38988> in this case, it's probably better to use the "in" operator: if "\f" in line: print "found a line feed" </F> -- http://mail.python.org/mailman/listinfo/python-list