正则表达式中最常见的符号和字符
来源:互联网 发布:值得买的电子产品知乎 编辑:程序博客网 时间:2024/05/18 15:51
Notation
Description
Example RE
Symbols
literal
Match literal string valueliteral
foo
re1|re2
Match regular expressionsre1 orre2
foo|bar
.
Matchany character (except NEWLINE)
b.b
^
Match start of string
^Dear
$
Match end of string
/bin/*sh$
*
Match 0 or more occurrences of preceding RE
[A-Za-z0-9]*
+
Match 1 or more occurrences of preceding RE
[a-z]+\.com
?
Match 0 or 1 occurrence(s) of preceding RE
goo?
{N}
Match N occurrences of preceding RE
[0-9]{3}
{M,N}
Match from M to N occurrences of preceding RE
[0-9]{5,9}
[...]
Match any single character fromcharacter class
[aeiou]
[..x-y..]
Match any single character in therange fromx toy
[0-9],[A-Za-z]
[^...]
Do not match any character from character class, including any ranges, if present
[^aeiou], [^A-Za-z0-9_]
(*|+|?| {})?
Apply "non-greedy" versions of above occurrence/repetition symbols (*,+,?, {})
.*?[a-z]
(...)
Match enclosed RE and save assubgroup
([0-9]{3})?, f(oo|u)bar
Special Characters
\d
Match any decimal digit, same as [0-9](\D is inverse of \d: do not match any numeric digit)
data\d+.txt
\w
Match any alphanumeric character, same as [A-Za-z0-9_] (\W is inverse of\w)
[A-Za-z_]\w+
\s
Match any whitespace character, same as [ \n\t\r\v\f] (\S is inverse of\s)
of\sthe
\b
Match anyword boundary (\B is inverse of \b)
\bThe\b
\nn
Match saved subgroup nn (see (...) above)
price: \16
\c
Match any special character c verbatim (i.e., with out its special meaning, literal)
\., \\, \*
\A (\Z)
Matchstart (end) of string (also see^ and $ above)
\ADear
REF:Core Python Programming
- 正则表达式中最常见的符号和字符
- python 正则表达式中最常见的符号和字符
- 正则表达式常用的符号和字符
- Javascript正则表达式常用的字符和符号
- 常用正则表达式符号和特殊字符
- 常用正则表达式符号和特殊字符
- 正则表达式常见的一些符号含义
- 正则表达式常见的一些符号含义
- 正则表达式的符号和常用表达式
- java正则表达式-常见符号
- 正则表达式符号字符大全
- 正则表达式中符号的全部解释
- mvc3中@符号和正则表达式中的@符号冲突的解决方法
- 中文符号和中文的正则表达式
- 正则表达式的符号和方法
- java中字符"\"和"/"的正则表达式问题
- 正则表达式中常用符号
- 正则表达式符号及特殊字符一览
- c99之 柔性数组成员
- STL源码剖析 容器 stl_set.h
- 加了锁的单例模式取对象
- .net中使用母版页后获取服务器控件的ID
- Yu Ji
- 正则表达式中最常见的符号和字符
- Spring框架之Filter应用
- Cocos2d-x Sprite 执行 CCFade~ 这类透明度变化动作的一些问题
- Device Registration and Initialization
- IOCP一:AcceptEx
- ZOJ 3787 Access System 模拟
- 界面超漂亮的桌面时钟
- 固定DIV不随滚动条滚动
- 卖票