import res = '''whatever...{|line1|} whatever...{|lineXXX '''res = re.sub(r'{\|(?:(?!\|}).)*$', '', s, flags=re.S)print(res)
Standard input is empty
whatever... {| line1 |} whatever...
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!