search_for = 'This is an example string'
search_for_re = '\\b' + '\\s+'.join(search_for.split()) + '\\b'
pattern = re.compile(search_for_re)
match = lambda s: pattern.match(s) is not None
s = 'This is an example string'
print(match(s), ':', repr(s))
s = """This is an 
 example string"""
print(match(s), ':', repr(s))
s = """This is 
 an unmatching string"""
print(match(s), ':', repr(s))
Matching a string that's arbitrarily splits over multiple lines