import re
regex = re.compile(r"['rocola'], r'([^ ]*\K)'")
test_str = ("rocola <-- that works then, r'' stuff inside should match infinite stuff separed by spaces, then python does the work\n"
"for example\n\n"
"rocola something another\n\n"
"the stuff inside r'' should match something, another, and all the stuff that goes after that, so python divides it into groups :O")
match = regex.search(test_str)
if match:
print(f"Match 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