when using the pipe character |
, how do I get all the results defined in my regex to return?
Or does the .search()
method only return the first result found?
Here is my code:
import re
bat.Regex = re.compile(r'Bat(man|mobile|copter|bat)')
matchObject = batRegex.search('Batmobile lost a wheel, Batcopter is not a chopper, his name is Batman, not Batbat')
print(matchObject.group())
Only the first result 'batmobile'
is returned, is it possible to return all results?
Thanks!