python method
  • search
    • wordlist = [w for w in nltk.corpus.words.words('en' ) ifw.islower()]
    • print [w for w in wordlist if re.search('ed$' ,w)]
  • findall
    • word = 'supercalifragilisticexpialidocious'
    • print re.findall('[abcd]', word)
 
 
注意点:
word = 'dsupercalifragilisticexpialidocious'
print re.findall('[abcd]',word)
print re.findall('^[abcd]',word)
print re.findall('[^abcd]',word)
 
分别代表:
匹配abcd任意一个
在开头匹配abcd任意一个
匹配非abcd任意一个

正则表达式 Regular Expressions的更多相关文章

  1. 正则表达式Regular expressions

    根据某种匹配模式来寻找strings中的某些单词 举例:如果我们想要找到字符串The dog chased the cat中单词 the,我们可以使用下面的正则表达式: /the/gi 我们可以把这个 ...

  2. 学习笔记之正则表达式 (Regular Expressions)

    正则表达式_百度百科 http://baike.baidu.com/link?url=ybgDrN2WQQKN64_gu-diCqdeDqL8LQ-jiQ-ftzzPaNUa9CmgBRDNnyx50 ...

  3. 正则表达式(Regular expressions)使用笔记

    Regular expressions are a powerful language for matching text patterns. This page gives a basic intr ...

  4. 自学Zabbix8.1 Regular expressions 正则表达式

    点击返回:自学Zabbix之路 点击返回:自学Zabbix4.0之路 点击返回:自学zabbix集锦 自学Zabbix8.1 Regular expressions 正则表达式 1. 配置 点击Adm ...

  5. 正则表达式备忘录-Regular Expressions Cheatsheet中文版

    正则表达式备忘录Regular Expressions Cheatsheet中文版原文:https://www.maketecheasier.com/cheatsheet/regex/ 测试文件a.t ...

  6. Python之Regular Expressions(正则表达式)

    在编写处理字符串的程序或网页时,经常会有查找符合某些复杂规则的字符串的需要.正则表达式就是用于描述这些规则的工具.换句话说,正则表达式就是记录文本规则的代码. 很可能你使用过Windows/Dos下用 ...

  7. 转载:邮箱正则表达式Comparing E-mail Address Validating Regular Expressions

    Comparing E-mail Address Validating Regular Expressions Updated: 2/3/2012 Summary This page compares ...

  8. Regular Expressions --正则表达式官方教程

    http://docs.oracle.com/javase/tutorial/essential/regex/index.html This lesson explains how to use th ...

  9. Regular Expressions in Grep Command with 10 Examples --reference

    Regular expressions are used to search and manipulate the text, based on the patterns. Most of the L ...

随机推荐

  1. CSS3 filter10种特效整理

    -webkit-filter是css3的一个属性,Webkit率先支持了这几个功能,感觉效果很不错.一共有10种最基本的特效,下来这个DEMO很好的展示了这些效果: <!DOCTYPE html ...

  2. canvas画时钟

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http ...

  3. Socket的双网卡收发(C#)

    最近的一个项目中需要同时使用两块网卡收发UDP组播数据包,并且要求使用Socket的方式接收和发送网络数据包(我不会告诉你们我之前是直接使用SharpPcap来实现的).在C#中Socket接触的比较 ...

  4. C#委托详解(3):委托的实现方式大全(续)

    接上篇(C#委托详解(2):实现方式大全),本篇继续介绍委托的实现方式. 4.Action<T>和Func<T>委托 使用委托时,除了为每个参数和返回类型定义一个新委托类型之外 ...

  5. Careercup - Microsoft面试题 - 6337018766295040

    2014-05-10 06:38 题目链接 原题: What do you think is the next big thing in technology? For example, search ...

  6. python--参数列表的分拆

    当你要传递的参数已经是一个列表,调用的函数却接受分开一个个的参数,这个时候可以考虑参数列表拆分: 可以使用* 操作符来自动把参数列表拆开: args=[3,6] x=list(range(*args) ...

  7. ios 调用打印机

    源码 无意中玩一个demo发现调用了打印机  才发现ios有快速调用打印机的功能. if ([UIPrintInteractionController isPrintingAvailable] == ...

  8. destoon使用中的一些心得

    //**************************index首页相关参数**************************************// //全局变量 {if $seo_titl ...

  9. HDU1013Digital Roots

    G - Digital Roots Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u   ...

  10. Linux Rsync

    一.Rsync介绍 1.什么是Rsync Rsync 即Remote Rynchronization,是一款开源的.快速的.多功能的.可实现全量或增量的本地或者远程数据镜像同步复制.备份的优秀工具. ...