使用python的re模块做模式匹配时,有时需要忽略大小写,只需要在re.search()函数中添加参数re.IGNORECASE即可
mystring = 'some string' pattern = 'some pattern' match = re.search(pattern, mystring, re.IGNORECASE)
正则表达式模块使用说明:https://docs.python.org/2/library/re.html
使用python的re模块做模式匹配时,有时需要忽略大小写,只需要在re.search()函数中添加参数re.IGNORECASE即可
mystring = 'some string' pattern = 'some pattern' match = re.search(pattern, mystring, re.IGNORECASE)
正则表达式模块使用说明:https://docs.python.org/2/library/re.html
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。