正则表达式 meta character

 
The metacharacter in regular expression:(自己总结的,可能不全)
 
Metacharacter Description
? (1)The preceding item is optional and will be matched, at most, once.
+ The preceding item will be matched one or more times.
* The preceding item will be matched zero or more times.
( make subexpressions
or to put boundaries on parts of expressions
)
. Matches any single character
| logical OR(也就是正则表达式中的或操作)
^  
(1)represents the characters not in the range of a list.
(2)the start of input text
/ escape character(转义符)
[ define your own character classes
 using the notation [...]. 
]
{ define the Range Interval for matching
}
$ the end of text
&& logical AND
 
Note: (节选自网页:)
   Operator    Effect
   .    Matches any single character.
   ?    The preceding item is optional and will be matched, at most, once.
   *    The preceding item will be matched zero or more times.
   +    The preceding item will be matched one or more times.
   {N}    The preceding item is matched exactly N times.
   {N,}    The preceding item is matched N or more times.
   {N,M}    The preceding item is matched at least N times, but not more than M times.
   -    represents the range if it's not first or last in a list or the ending point of a range in a list.
   ^    Matches the empty string at the beginning of a line; also represents the characters not in the range of a list.
   $    Matches the empty string at the end of a line.
   /b    Matches the empty string at the edge of a word.
   /B   Matches the empty string provided it's not at the edge of a word.
   /<   Match the empty string at the beginning of word.
   />    Match the empty string at the end of word.
 
Two regular expressions may be concatenated; the resulting regular expression matches any string formed by concatenating two substrings that respectively match the concatenated subexpressions.
 
Two regular expressions may be joined by the infix operator "|" ; the resulting regular expression matches any string matching either subexpression.
 
Repetition takes precedence over concatenation, which in turn takes precedence over alternation. A whole subexpression may be enclosed in parentheses to override these precedence rules.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值