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

【Python】正则表达式1(未完)

时间:2017-05-13 23:22:40      阅读:229      评论:0      收藏:0      [点我收藏+]

标签:str   ons   target   com   .com   cal   cin   comm   art   

1、正则表达式唯一的用途就是在文本中匹配和寻找模式,模式可以简单,也可以复杂。

 

2、Regexr 这个网站很个性的就是,有一个community标签,打开后可以看到评分由高到低排列的 正则。

 

3、待匹配的文本 顺便mark 作者的git

THE RIME OF THE ANCYENT MARINERE, IN SEVEN PARTS.

ARGUMENT.

How a Ship having passed the Line was driven by Storms to the cold
Country towards the South Pole; and how from thence she made her course
to the tropical Latitude of the Great Pacific Ocean; and of the strange
things that befell; and in what manner the Ancyent Marinere came back to
his own Country.

I.

1 It is an ancyent Marinere,
2 And he stoppeth one of three:
3 "By thy long grey beard and thy glittering eye
4 "Now wherefore stoppest me?

 

4、字符组取反:\D 等价 [^0-9] 等价 [^\d] 匹配所有非数字。

 

5、\w

 

【Python】正则表达式1(未完)

标签:str   ons   target   com   .com   cal   cin   comm   art   

原文地址:http://www.cnblogs.com/xkxf/p/6850552.html

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