If you just want to check if there is a new line ( \n ), you can simply use the Python in statement to check if it is in the line:
>>> "\n" in "hello\ngoodbye" True
... or as part of an if :
if "\n" in foo: print "There a newline in variable foo"
In this case, you do not need to use regular expressions.
Mark longair
source share