Regular Expression
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.
| 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的更多相关文章
- [LeetCode] Regular Expression Matching 正则表达式匹配
Implement regular expression matching with support for '.' and '*'. '.' Matches any single character ...
- myeclipse中导入js报如下错误Syntax error on token "Invalid Regular Expression Options", no accurate correc
今天在使用bootstrap的时候引入的js文件出现错误Syntax error on token "Invalid Regular Expression Options", no ...
- [LeetCode] 10. Regular Expression Matching
Implement regular expression matching with support for '.' and '*'. DP: public class Solution { publ ...
- No.010:Regular Expression Matching
问题: Implement regular expression matching with support for '.' and '*'.'.' Matches any single charac ...
- Regular Expression Matching
Implement regular expression matching with support for '.' and '*'. '.' Matches any single character ...
- 【leetcode】Regular Expression Matching
Regular Expression Matching Implement regular expression matching with support for '.' and '*'. '.' ...
- 【leetcode】Regular Expression Matching (hard) ★
Implement regular expression matching with support for '.' and '*'. '.' Matches any single character ...
- grep(Global Regular Expression Print)
.grep -iwr --color 'hellp' /home/weblogic/demo 或者 grep -iw --color 'hellp' /home/weblogic/demo/* (-i ...
- 66. Regular Expression Matching
Regular Expression Matching Implement regular expression matching with support for '.' and '*'. '.' ...
- Jmeter组件4. Regular Expression Extractor
位置:Post-Processors - Regular Expression Extractor 所谓的Post-Processors直译为后处理器,意思是在域内所有Sampler执行完后才会执行, ...
随机推荐
- jQuery 2
<head > <style type="text/css"> /*table中偶数行*/ .tabEven { bac ...
- ubuntu14上安装nltk
安装nltk 1)在buntu终端命令键入:wget https://bootstrap.pypa.io/ez_setup.py,下载ez_setup.py. 2)下载完成后后,键入:sudo py ...
- 【NIFI】 Apache NiFI 之 ExecuteScript处理(一)
本例介绍NiFI ExecuteScript处理器的使用,使用的脚本引擎ECMScript FlowFile I / O简介 NiFi中的流文件由两个主要组件构成,即属性和内容.属性是关于内容/流文件 ...
- springMVC 学习 五 参数传递(包括restful风格)
(一)SpringMVC Controller接受参数的方式 (1) 前端传递的参数,在springMVC的controller中使用基本数据类型或者String 类型进行接受 在前端有一个form表 ...
- WordCount改进 小组项目
GitHub地址:https://github.com/DM-Star/WordCount-opt 作业需求:http://www.cnblogs.com/ningjing-zhiyuan/p/865 ...
- svn checkout单个文件
http://www.letuknowit.com/archives/svn-checkout-single-file/ 有时候需要在svn版本仓库中某个比较上层的目录中(比如根目录)checkout ...
- python生成器初步了解
一.生成器 生成器的本质就是迭代器 一个一个的创建对象 1.创建生成器的方式: 1.生成器函数 2.通过生成器表达式来获取生成器 3.类型转换 2.优点 节省内存 ,生成器本身就是代码 ...
- 2019.01.08 codeforces 1009F. Dominant Indices(长链剖分)
传送门 长链剖分模板题. 题意:给出一棵树,设fi,jf_{i,j}fi,j表示iii的子树中距离点iii距离为jjj的点的个数,现在对于每个点iii要求出使得fif_ifi取得最大值的那个jjj ...
- $.cookie is not a function的错误原因
网上说的原因是:“手残导入2次jquery库文件 ” 是的,就是这个原因.引入了两次jquery.js
- IntelliJ IDEA 2017版 spring-boot 2.03 去除控制台logo;去除springboot 图标;去除springboot 图
1.控制台出现logo图标 2.如果不喜欢,如何去除这个logo 在其Application中进行设置 package com.springboot.logo; import org.springfr ...