python 正则表达式
来源:互联网 发布:swift 源码下载 编辑:程序博客网 时间:2024/05/21 21:47
re.I:不区分大小写
#!/usr/bin/env pythonimport res = re.findall(r'error', 'error\nError\nERROR')print ss = re.findall(r'error', 'error\nError\nERROR', re.I)print s
结果:
['error']['error', 'Error', 'ERROR']
re.S:使 "." 特殊字符完全匹配任何字符,包括换行;没有这个标志, "." 匹配除了换行外的任何字符。
#!/usr/bin/env pythonimport res = re.findall(r"a(\d+)b.*a(\d+)b", "a12b\na23b")print ss = re.findall(r"a(\d+)b.*a(\d+)b", "a12b\na23b", re.S)print s结果:
[][('12', '23')]
re.M:^$标志将会匹配每一行,默认^和$只会匹配第一行
#!/usr/bin/env pythonimport res = re.findall(r"^a(\d+)b", "a23b\na34b")print ss = re.findall(r"^a(\d+)b", "a23b\na34b", re.M)print s结果:
['23']['23', '34']
0 0
- python正则表达式学习
- c++正则表达式,python
- Python正则表达式(一)
- python的正则表达式
- Python正则表达式
- Python初学-正则表达式
- 正则表达式与python
- python正则表达式学习
- python正则表达式学习
- python正则表达式学习
- python正则表达式
- Python - 正则表达式
- Python正则表达式
- python正则表达式
- Python正则表达式指南
- Python正则表达式指南
- Python 正则表达式指南
- python 正则表达式
- silverlight - dataGrid多表头
- 2014-15赛季已然过半...
- C#解析Excel汇总
- 几步搞定Service不被杀死
- FAILED: Error in metadata: InvalidOperationException(message:Database hive is not empty)
- python 正则表达式
- linux学习(五) find命令详解
- 加班ing
- tomcat的内存及加大TOMCAT的连接数
- C语言编程(练习4:数组与指针)
- 背包问题的几种解法总结
- 有关核心系统单元测试的简要分析
- crosswalk 快速入门,利用WebRTC(html)开始开发视频通话
- 分布式系统学习:Hadoop集群部署(1)