import re
xml = """
Yacc
Filip Maric
2004
Matematicki fakultet
100
Fredrik Lundh
50
O’Reilly & Associates
2001
Python Standard Library
"""
m = re.search(r'(?!.*.*
Python Standard Library ).*(?P Python Standard Library ).*?', xml, flags=re.DOTALL)
print(m.group('book'))
m = re.search(r'(?!.*.* Yacc ).*(?P Yacc ).*?', xml, flags=re.DOTALL)
print(m.group('book'))