import res = "abcde\n fghij<FooBar>";rx = r"(.*)<FooBar>";m = re.search(rx, s, flags=re.S)if m: print(m.group(1))
Standard input is empty
abcde fghij
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!