Regular expression
来源:互联网 发布:vue.js可以做什么 编辑:程序博客网 时间:2024/05/01 21:24
--predefined character class:
Character Matches Character Matches
\d any digit \D any nondigit
\w any word character \W any nonword character
\s any white-space character \S any nonwhite-space
character
Note that in java, we should start the escape sequence \ in a String, the two \ are needed, for example a character class attempting to match any digit one or more times, the subexpression should be \\d+ .
--custom define character class:
[aeiou] matches a SINGLE character in the [], that is a vowel;
-regular expression operator
operator description
* match zero or more occurrences of the subexpression
(quantifier) immediately preceding the "*"
+ match one or more occurrences of the subexpression
immediately preceding the "+"
| matches the expression to its left or to its right, and the
parentheses () are used to group parts of the regex ,
for example "Hi(Bruce|Jane)"
Quantifier Matches
* Matches zero or more occurrences of the pattern.
+ Matches one or more occurrences of the pattern.
? Matches zero or one occurrences of the pattern.
{n} Matches exactly n occurrences.
{n,} Matches at least n occurrences.
{n,m} Matches between n and m (inclusive) occurrences.
metacharacters supported by Java API are: <([{\^-=$!|]})?*+.>
Miscellaneous
Apostrophe: the mark '
Hyphen: the mark -
- regular expression
- Regular Expression
- regular expression
- Regular Expression
- Regular Expression
- regular expression
- Regular Expression
- Regular Expression
- regular expression
- Regular expression
- Regular Expression
- Regular Expression
- regular expression
- Regular expression
- regular expression
- regular expression
- Regular Expression
- regular expression
- 在菲遭绑粤商仍无消息
- 关系型数据库
- C3p0配置详解
- ubuntu下安装editplus(exe)文件
- 移动网络名词理解(6)---sms
- Regular expression
- 移动网络名词理解(7)---mms
- 第6章 论堆排序
- 即插即用和电源管理例程设置的配置结构
- 黑马程序员 集合的复习
- 输不起的人生与爱情
- Linux下的IPC-命名管道的使用
- 浮躁,淡定
- win7下 vs2010+mycui编译配置