I need an example of a regular expression that: - matches an empty string - matches a non-empty string - does NOT match a string consisting of only a linefeed So, this test should produce [1, 1, 0]... import re pat = '^(.+)?$' # FIXME [(re.search(pat, s) is not None) for s in ['', 'foo', '\n']] Any suggestions? :) Thanks