Eclipse Regular expression grammar

http://www.eclipse.org/tptp/home/downloads/installguide/gla_42/ref/rregexp.html

Regular expression grammar

The Adapter Configuration Editor allows you to use regular expressions to describe how log files should be transformed into Common Base Event records. The following tables are a guideline to regular expression usage.

General rules

  • | separates alternatives.
  • Expressions within parentheses are matched as subpattern groups and saved for use by certain methods.
  • By default, a quantified subpattern matches as many times as possible without causing the rest of the pattern not to match. To change the quantifiers to match the minimum number of times possible, without causing the rest of the pattern not to match, use a ? right after the quantifier.
  • Perl5 extended regular expressions are fully supported.

 

Regular expression matching

ExpressionMatches
{n,m}at least n but not more than m times
{n,}at least n times
{n}exactly n times
*0 or more times
+1 or more times
?0 or 1 times
.everything except \n in a regular expression within parentheses
^a null token matching the beginning of a string or line (i.e., the position right after a newline or right before the beginning of a string) in a regular expression within parentheses
$a null token matching the end of a string or line (that is, the position right before a newline or right after the end of a string) in a regular expression within parentheses
\bbackspace inside a character class ([abcd])
\bnull token matching a word boundary (\w on one side and \W on the other)
\Bnull token matching a boundary that isn't a word boundary
\Aonly at beginning of string
\Zonly at end of string (or before newline at the end)
\newline
\rcarriage return
\ttab
\fform feed
\ddigit [0-9]
\Dnon-digit [^0-9]
\wword character [0-9a-z_A-Z]
\Wnon-word character [^0-9a-z_A-Z]
\sa whitespace character [ \t\n\r\f]
\Sa non-whitespace character [^ \t\n\r\f]
\xnnthe hexadecimal representation of character nn
\cDthe corresponding control character
\nn or \nnnthe octal representation of character nn unless a backreference.
\1, \2, \3...whatever the first, second, third, and so on, parenthesized group matched. This is called a backreference. If there is no corresponding group, the number is interpreted as an octal representation of a character.
\0the null character. Any other backslashed character matches itself .
*?0 or more times
+?1 or more times
??0 or 1 times
{n}?exactly n times
{n,}?at least n times
{n,m}?at least n but not more than m times

 

rouping and extracting matches

To group parts of an expression, use the metacharacters ( ). This allows the regular expression in the parentheses to be treated as a single unit. For example, the regular expression

severity:(1|2)

matches the pattern severity:1 or severity:2.

 

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值