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执行完后才会执行, ...
随机推荐
- Linux学习笔记:系统目录结构
Linux系统文件夹代表的含义: /bin - Binaries. /boot - Files required for booting. /dev - Device files. /etc - Et ...
- DockerDesktop简单安装和使用
一.在windows10下,安装DockerDesktop: 1.检查windows版本为企业版或专业版,并开启Hyper-v系统设置:电脑的控制面板->程序->启用或关闭Windows功 ...
- mybatis缓存(一,二级别)
数据查找过程: 二级缓存(默认关闭) -> 一级缓存(默认开启) -> 数据库 一级缓存: 一级缓存是SqlSession自带的.SqlSession对象被创建,一级缓存就存在了.//是针 ...
- mybatis 接口绑定 和 动态SQL
一.MyBatis 接口绑定方案及多参数传递 1.作用:实现创建一个接口后把mapper.xml由mybatis生成接口的实现类,通过调用接口对象就可以获取mapper.xml中编写的sql 2.后面 ...
- 【转】PHP实现验证码
转自http://www.jb51.net/article/40341.htm 新建一个captcha.php: //验证码类class Captcha { private $charset = 'a ...
- hdu-2795(线段树的简单应用)
题目链接:传送门 参考文章:https://blog.csdn.net/qiqi_skystar/article/details/50299743 题意:给出一个高h,宽w的方形画板,有高位1宽为wi ...
- myeclipse安装svn方法汇总
myeclipse安装svn方法汇总 博客分类: eclipse MyEclipse6.5安装SVN插件,掌握了几种方法,本节就像大家介绍一下MyEclipse6.5安装SVN插件的三种方法,看完 ...
- python基本数据类型之字符串(一)
python中字符串中有很多方法,具体方法如下图所示: 分割方法 字符串的分割方法: 1.join方法: join方法是字符串方法中最重要的方法之一,它的作用是将某一字符插入到字符串中用作连接. 具体 ...
- altera FIFO知识点
虽然是很常用的IP,但经常用时还要看下文档,某些知识点如果能记住的话,还是可以节省很多时间的. (1)输入输出位宽不相等 这里以输入16位数据输出为8位数据为例,写入两16位的数据,读出4个8位的 ...
- 公司内部Samba 服务器架设
1.需求 在公司内部打造一个文件管理系统,其作用域仅仅在公司内部,支持在线对文件的修改和保存操作等,同时也要注意权限问题. 2.策划 目前设立四个群组:运维.开发 .测试和普通,当然所对应的对文件的访 ...