import re
regex = re.compile(r"(\bbod\S*)|(embodi\S*)", flags=re.IGNORECASE)
test_str = ("Fancher: what does Eugene teach us about embodiment (for disembodied chatter bot) and intelligence? #RSA16\n\n"
"Faris: And in spite of turns to embodiment and sensation, little on eros of bodies #o15 #rsa16\n\n"
"Kerschbaum: Embodiment and embodied knowledge is always embedded with our decisions and navigations of spaces. #rsa16\n\n"
"#yesallwomen shows digital embodiment through storytelling. #g19 #RSA16 @RCMeg\n\n"
"Virtual is an extension of the corporeal body. We must pay attention to movement. To embodiment. #RSA16 #g19\n\n"
"#i5 #RSA16 @DrJenTalbot parrhesia assumes static notions of embodiment and power")
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