码迷,mamicode.com
首页 > 编程语言 > 详细

python 正则小例子

时间:2016-11-27 23:42:28      阅读:242      评论:0      收藏:0      [点我收藏+]

标签:换行   link   blog   pre   color   module   小例子   dal   python   

 1 import  re
 2 
 3 s1 = 1 (021)8567895 90
 4 s2 = 1 021-5689564 90
 5 s3 = 1 021 4886542 90
 6 s4 = 1 0218567899 90
 7 s5 = module-layout=\"layout-d\">\n  \n \n\n<link 
 8 s6 = module-layout=\"layout-d\n<link 
 9 m1 = re.findall(r\(\d{3}\)\d{7,8},s1)
10 m2 = re.findall(r\d*-\d{7,8},s2)
11 m3 = re.findall(r\d{2,3}[ -]?\d{1,10},s4)
12 m5 = re.findall(rmodule-layout=.*,s6,re.S)#re.S 让  .  匹配换行符

 

python 正则小例子

标签:换行   link   blog   pre   color   module   小例子   dal   python   

原文地址:http://www.cnblogs.com/zsl-3/p/6107375.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!