How can Python regex ignore case inside a part of a pattern but not the entire expression?

心不动则不痛 提交于 2019-11-30 19:59:46

The re module doesn't support scoped flags, but there's an alternative regex implementation which does:

http://pypi.python.org/pypi/regex

Python does not support disabling flags in the same manner; you will have to handle it differently.

>>> re.match('[Ff][Oo]{2}bar', 'Foobar')
<_sre.SRE_Match object at 0x7eff94dac920>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!