It's a very elegant summary of regular expression from The AWK Programming Language.

1. The regular expression metacharacters are:

\ ^ $ . [ ] | ( ) * + ?

2. A basic regular expression is one of the following:

  • a nonmetacharacter, such as A, that matches itself.
  • an escape sequence that matches a special symbol: \t matches a tab.
  • a quoted metacharacter, such as \*, that matches the metaqcharacter literally.
  • ^, which matches the beginning of a string.
  • $, which matches the end of a string.
  • ., which matches any single character.
  • a character class: [ABC] matches any of the characters A, B, or C. Character classes may include abbreviations: [A-Za-z] matches any single letter.
  • a complemented character class: [^0-9] matches any character except a digit.

3. These operators combine regular expressions into larger ones:

  • alternation: A | B matches A or B.
  • concatenation: AB matches A immediately followed by B.
  • closure: A* matches zero or more A's.
  • positive closure: A+ matches one or more A's.
  • zero or one: A? matches the null string or A.
  • parentheses: (r) matches the same strings as r does.

Regular Expressions
Expression Matches
c  the nonmetacharacter c
\c  escape sequence or literal character c
 ^  beginning of string 
 $  end of string
 .  any character
 [$c_1$$c_2$...]  any character in $c_1$$c_2$
 [^$c_1$$c_2$...]  any character not in $c_1$$c_2$
[$c_1$-$c_2$]   any character in the range beginning with $c_1$ and ending with $c_2$
 [^$c_1$-$c_2$]  any character not in the range $c_1$ to $c_2$
 $r_1$|$r_2$  any string matched by $r_1$ or $r_2$
($r_1$)($r_2$)   any string xy where $r_1$ matches x and $r_2$ matches y; parentheses not needed around arguments with no alternations
 (r)*  zero or more consecutive strings matched by r 
 (r)+  one or more consecutive strings matched by r
 (r)?  zero or one string matched by r parentheses not needed around basic regular expressions 
 (r)  any string matched by r

Regular Expression的更多相关文章

  1. [LeetCode] Regular Expression Matching 正则表达式匹配

    Implement regular expression matching with support for '.' and '*'. '.' Matches any single character ...

  2. myeclipse中导入js报如下错误Syntax error on token "Invalid Regular Expression Options", no accurate correc

    今天在使用bootstrap的时候引入的js文件出现错误Syntax error on token "Invalid Regular Expression Options", no ...

  3. [LeetCode] 10. Regular Expression Matching

    Implement regular expression matching with support for '.' and '*'. DP: public class Solution { publ ...

  4. No.010:Regular Expression Matching

    问题: Implement regular expression matching with support for '.' and '*'.'.' Matches any single charac ...

  5. Regular Expression Matching

    Implement regular expression matching with support for '.' and '*'. '.' Matches any single character ...

  6. 【leetcode】Regular Expression Matching

    Regular Expression Matching Implement regular expression matching with support for '.' and '*'. '.' ...

  7. 【leetcode】Regular Expression Matching (hard) ★

    Implement regular expression matching with support for '.' and '*'. '.' Matches any single character ...

  8. grep(Global Regular Expression Print)

    .grep -iwr --color 'hellp' /home/weblogic/demo 或者 grep -iw --color 'hellp' /home/weblogic/demo/* (-i ...

  9. 66. Regular Expression Matching

    Regular Expression Matching Implement regular expression matching with support for '.' and '*'. '.' ...

  10. Jmeter组件4. Regular Expression Extractor

    位置:Post-Processors - Regular Expression Extractor 所谓的Post-Processors直译为后处理器,意思是在域内所有Sampler执行完后才会执行, ...

随机推荐

  1. OCIlib的几个函数的执行效率(附上pro*c的性能对比)

    ocilib提供了以下几个执行sql语句的函数 OCI_ExecuteStmt/OCI_ExecuteStmtFmt 使用没有绑定变量的语句 OCI_Execute 使用有绑定变量的语句 OCI_Im ...

  2. DevOps:从理念到实施

    转载自:http://os.51cto.com/art/201404/436794.htm DevOps这个新理念的出现,是为了应对IT环境中普遍面临的一些挑战.开发团队要求的不断满足新的客户需求,并 ...

  3. Java的背景、影响及前景

    一.背景 詹姆斯·高斯林出生于加拿大,是一位计算机编程天才.在卡内基·梅隆大学攻读计算机博士学位时,他编写了多处理器版本的Unix操作系统,是JAVA编程语言的创始人. 高斯林生于1955年,已婚,育 ...

  4. openstack之镜像管理

    概览 [root@cc07 fast-pulsar]# glance help | grep image [--os-image-url OS_IMAGE_URL] [--os-image-api-v ...

  5. 微信小程序的新的

    app.request.get('http://ele.kassing.cn/v1/pois',this.data.city).then(res=>{ console.log(res) this ...

  6. 第17章:MongoDB-聚合操作--聚合管道--$group

    ①$group 作用:将集合中的文档进行分组,可用于统计结果. 例如: db.scores.aggregate({“$group”:{“_id”:“$studentId”}}); 或者是 db.sco ...

  7. oss上传文件夹

    最近公司做工程项目,实现文件夹云存储上传. 网上找了很久,发现网上很多项目都存在相似问题,最后终于找到了一个符合我要求的项目. 工程如下: 这里对项目的文件夹云存储上传进行分析,实现文件夹上传,如何进 ...

  8. WEB上传大文件解决方案

    众所皆知,web上传大文件,一直是一个痛.上传文件大小限制,页面响应时间超时.这些都是web开发所必须直面的. 本文给出的解决方案是:前端实现数据流分片长传,后面接收完毕后合并文件的思路.下面贴出简易 ...

  9. __cxa_call_unexpected原因

    coredump的调用栈: #0  0xf76f5440 in __kernel_vsyscall () #1  0xf73c4657 in raise () from /lib/libc.so.6 ...

  10. (转)PHP5使用cookie时报错 cannot modify header information - headers already sent by (......)

    转自:http://blog.csdn.net/buyingfei8888/article/details/8899797 运行有警告Warning: Cannot modify header inf ...