import re
regex = re.compile(r"=+\n(.+)\n=+")
test_str = ("========================================\n"
"E:\\#\\1125 (2007) Victims Of Forgetting\\\n"
"========================================\n"
"!Moros 1125 - 01 - Intro.mp3 ::INFO:: 442Kb\n"
"!Moros 1125 - 02 - Resp=ect For=.mp3 ::INFO:: 2.30Mb\n"
"=!Moros 1125 - 03 - Victims Of For=getting.mp3 ::INFO:: 2.74Mb\n"
"!Moros 1125 - 04 - Broken Wings.mp3 ::INFO:: 1.49Mb\n"
"!Moros 1125 - 05 - Rotten World.mp3 ::INFO:: 2.35Mb\n"
"!Moros 1125 - 06 - 1125crew.mp3 ::INFO:: 2.72Mb\n"
"!Moros 1125 - 07 - Around You.mp3 ::INFO:: 2.14Mb\n"
"========================================\n"
"E:\\#\\1125 (2007) Victims Of Forgetting\\\n"
"========================================\n"
"!Moros 1125 - 01 - Intro.mp3 ::INFO:: 442Kb\n"
"!Moros 1125 - 02 - Respect For.mp3 ::INFO:: 2.30Mb\n"
"!Moros 1125 - 03 - Victims Of Forgetting.mp3 ::INFO:: 2.74Mb\n"
"!Moros 1125 - 04 - Broken Wings.mp3 ::INFO:: 1.49Mb\n"
"!Moros 1125 - 05 - Rotten World.mp3 ::INFO:: 2.35Mb\n"
"!Moros 1125 - 06 - 1125crew.mp3 ::INFO:: 2.72Mb\n"
"!Moros 1125 - 07 - Around You.mp3 ::INFO:: 2.14Mb\n"
"========================================\n"
"E:\\#\\1125 (2007) Victims Of Forgetting\\\n"
"========================================\n"
"!Moros 1125 - 01 - Intro.mp3 ::INFO:: 442Kb\n"
"!Moros 1125 - 02 - Respect For.mp3 ::INFO:: 2.30Mb\n"
"!Moros 1125 - 03 - Victims Of Forgetting.mp3 ::INFO:: 2.74Mb\n"
"!Moros 1125 - 04 - Broken Wings.mp3 ::INFO:: 1.49Mb\n"
"!Moros 1125 - 05 - Rotten World.mp3 ::INFO:: 2.35Mb\n"
"!Moros 1125 - 06 - 1125crew.mp3 ::INFO:: 2.72Mb\n"
"!Moros 1125 - 07 - Around You.mp3 ::INFO:: 2.14Mb")
matches = regex.finditer(test_str)
for match_num, match in enumerate(matches, start=1):
print(f"Match {match_num} was found at {match.start()}-{match.end()}: {match.group()}")
for group_num, group in enumerate(match.groups(), start=1):
print(f"Group {group_num} found at {match.start(group_num)}-{match.end(group_num)}: {group}")
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html