使用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