Python re.S【转】
来源:互联网 发布:c语言 逆波兰式计算器 编辑:程序博客网 时间:2024/04/30 23:40
转载自:http://www.myext.cn/other/a_29426.html 感谢博主!
在Python的正则表达式中,有一个参数为re.S。它表示多行匹配。看如下代码:
import rea = '''asdfsafhellopass:234455worldafdsf'''b = re.findall('hello(.*?)world',a)c = re.findall('hello(.*?)world',a,re.S)print 'b is ' , bprint 'c is ' , c
运行结果如下:
b is []c is ['pass:\n\t234455\n\t']
在字符串a中,包含换行符\n,在这种情况下,如果不使用re.S参数,则只在每一行内进行匹配,如果一行没有,就换下一行重新开始。而使用re.S参数以后,正则表达式会将这个字符串作为一个整体,在整体中进行匹配
0 0
- Python re.S【转】
- re.S--python中正则
- Python正则表达式中的re.S
- Python正则表达式中的re.S
- Python Re
- python re
- python re
- Python--re
- Python---re
- python re
- python re
- Python re - re module contents
- [转]Python中RE模块的应用
- [转]Python中RE模块的应用
- [转] Python中RE模块的应用
- Python 中re模块学习(转)
- re in python
- python的re模块
- Linux中如何查看修改系统的时间和时区
- storm supervisor启动报错java.lang.RuntimeException: java.io.EOFException
- 用Sublime Text2搭建VC编译环境
- 研究生怎么看 ,怎么写论文
- 红黑树的C实现完整代码
- Python re.S【转】
- 神云科技面试题
- Java 向上转型和向下转型
- 汉字学习
- Eclipse中搭建ssh框架
- C++进阶 必读书籍
- poj1064二分搜索
- ANT打包apk时出现乱码解决方案
- 不同内核浏览器的差异以及浏览器渲染简介