Using more than one flag in python re.findall

Solution 1:

Yes, but you have to OR them together:

x = re.findall(pattern=r'CAT.+?END', string='Cat \n eND', flags=re.I | re.DOTALL)

Solution 2:

You can't put the flags within a tuple. Use the pipe character (OR operand) within your flags:

x = re.findall(r'CAT.+?END','Cat \n eND',flags=re.I | re.DOTALL)

Solution 3:

Is there a way to use more than one flag ?

It wasn't mentioned, but you can use inline (?...) modifiers as well.

x = re.findall(r'(?si)CAT.+?END', 'Cat \n eND')