Using more than one flag in python re.findall

前端 未结 3 1940
一向
一向 2020-12-16 09:27

I would like to use more than one flag with the re.findall function. More specifically, I would like to use the IGNORECASE and DOTALL

3条回答
  •  轮回少年
    2020-12-16 10:06

    Yes, but you have to OR them together:

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

提交回复
热议问题