标签:c class a http tar ext
资料来源:Editplus Wiki
http://editplus.info/wiki/Regular_Expressions
http://editplus.info/wiki/Regular_expression_syntax
Regular Expressions 正则表达式
This page exists as a resource for Regular Expressions (also
shortened as RegEx or RegExp) frequently used in EditPlus. In
order to learn more about the particulars of creating a regular expression in
EditPlus, see regular
expression syntax. Also note that some
standard regular expressions are currently not supported.
该网页说明了在EditPlus中常用的正则表达式(Regular
Expressions,也通常缩写为RegEx 或
RegExp)。为了学习更多关于在EditPlus中生成正则表达式的详细说明,可以看正则表达式语法 。同时也要注意到有些标准的正则表达式目前还不支持。
Note: EditPlus only supports [POSIX] Regular Expressions, not [PCRE]
(Perl-Compatible Regular Expressions), which means there are no back-references,
no look-aheads, no fancy quantifiers, and no convenient character group
syntax]]. Just your basic ^, $, +, *, ?, [ ], [^ ], syntax. Also note that
+/* are always greedy.
注意:EditPlus只支持[POSIX]标准的正则表达式,二不是[PCRE](兼容Perl的正则表达式),这意味着EditPlus并不支持:回退引用、向前查找、花哨的量化词和方便的字符组语法(这些名词的翻译可能不准确,任何建议请回复本文,谢谢)。它只支持基本的^,
$, +, *, ?, [ ], [^ ]等语法。还要主要到 +/* 总是很贪婪的。
Regular expression syntax
正则表达式语法
EditPlus supports Regular Expressions in search and replace,
but its engine is not as feature-rich as others. A list of common regular
expression features not available in EditPlus is available here.
Please see Regular
Expressions for some commonly used examples.
Operators and Syntax Supported in EditPlus
在EditPlus中支持的操作符和语法
- \
- escape (\ = \\) used for matching characters that have special meaning as
regular expressions
- 转义符号,用于匹配那些作为正则表达式有特殊含义的字符(比如要匹配字符\,使用\\即可)
- ^
- (caret) beginning of line (assertion)
- 匹配一行的开始(插入)
- $
- end of line (assertion)
- 匹配一行的结束(插入)
- \t
- horizontal tab (0x09)
- 制表符(即对应ASCII代码0x09)
- \n
- newline (0x0A or 0x0D or 0x0D+0x0A)
- 新的一行(对应ASCII代码0x0A 或 0x0D 或 0x0D+0x0A)
- .
- (period) any character
- 代表任意字符
- ( )
- referencable grouping, see \0 - \9 below, e.g. (foo) matches "foo"
- 表达式分组标记,可引用的组,看后面的\0 - \9,例如(foo)匹配"foo"
- [ ]
- character class (or-list), e.g. [abc] matches "a", "b", or
"c"
- 匹配字符集合或者字符列表中任意一个字符,例如 [abc] 匹配 "a", "b", 或 "c"
- [^ ]
- negated character class, e.g. [^abc] matches a character that is not "a",
"b", or "c"
- 匹配除字符集合或者字符列表之外的任意一个字符,例如[^abc]将不会匹配 "a", "b", 或 "c"
- -
- (minus sign) character range used within character class, e.g. [a-z]
matches a character in the range "a" through "z"
- (减号)用在字符列表中表示字符范围,例如[a-z]匹配从"a" 到 "z"的字符
- |
- (vertical bar) logical or, e.g. (foo|bar) matches "foo" or "bar"
- (垂直符号)逻辑或,例如(foo|bar) 匹配 "foo" 或 "bar"
- *
- (asterisk) match the preceding character or group zero or more times, e.g.
foo* matches "fo", "foo", "fooo", etc, but not "f"
- (星号)匹配它前面的字符或组零次或多次,例如 foo* 匹配 "fo", "foo", "fooo", 等等, 但是不会匹配 "f"
- +
- (plus-sign) match the preceding character or group one or more times, e.g.
foo+ matches "foo", "fooo", etc, but not "f" or "fo"
- (加号)匹配它前面的字符或组一次或多次,例如 foo+ 匹配 "foo", "fooo", 等等, 但是不会匹配 "f" 或 "fo"
- ?
- (question mark) match the preceding character or group zero or once only,
e.g. foo? only matches "fo" and "foo"
- (问号)匹配它前面的字符或组零次或一次,例如 foo? 只匹配 "fo" 和 "foo"
- \0 - \9
- used in "Replace with" field to represent text matched with parenthesis
(\0 = whole match, \1 - \9 = submatches), no back-references
- 在“替换为”框里表示括号匹配的文本(\0 = 全匹配, \1 - \9 = 子匹配),不支持回退引用
- &
- When used in the "Replace with" field, the entire match is replaced. To
replace with an actual ampersand, you must escape it \&
- 在“替换为”框里使用时,会匹配整个表达式。要替换为 "&" 符号,必须转义,使用 \&
Operators
and Syntax Not Supported in EditPlus 在EditPlus中不支持的操作符和语法
Some common regular expression syntax/operators not available in
EditPlus:
- foo{num}
- match foo exactly num times
- foo{min, max}
- match foo at least min and at most max times,
both optional
- \a
- 0x07, BEL
- \f
- 0x0C, formfeed
- \r
- 0x0D, carriage return, see \n
- \e
- 0x1B, ESC
- \xfoo
- 0xfoo, hexadecimal character reference
- \cfoo
- control-foo
- \s
- whitespace character, use [ \t\n]
- \S
- non-whitespace character, use [^ \t\n]
- \d
- decimal digit, use [0-9]
- \D
- not a decimal digit, use [^0-9]
- \w
- word character, letter, for English use [A-z]
- \W
- non-word character, non-letter, for English use [^A-z]
- [[:alpha:]], [[:lower:]], [[:upper:]], [[:alnum:]], [[:digit:]],
[[:xdigit:]], [[:punct:]], [[:graph:]], [[:print:]], [[:blank:]],
[[:space:]]
- predefined character classes (POSIX)
- \b
- word boundary (assertion)
- \B
- not a word boundary (assertion)
- \A
- subject start (assertion), use ^
- \Z
- subject end (assertion), use [\n$]
- \z
- subject end (assertion), use $
- assertions other than ^ and $
- parts of patterns that are not added to matches:
- (?=foo)
- positive assertion
- (?!foo)
- negative assertion
- (?<=foo), (?<!foo)
- look-behind assertion
- (?>=foo), (?>!foo)
- look-ahead assertion, once-only sub-pattern
- (?(foo)true),
(?(foo)true|false)
- conditional sub-pattern, foo being either the number of a
sub-pattern or an assertion
- (?:foo)
- grouping, non-referencable
- (?ifoo), (?mfoo), (?sfoo),
(?xfoo)
- inline modifiers
- (?R)
- recursive pattern
- (?#foo)
- comment
Workaround
A user tool, Full RegEx Supported Replace and More has been developed that
adds full regex support to EditPlus.
Editplus的正则表达式,布布扣,bubuko.com
Editplus的正则表达式
标签:c class a http tar ext
原文地址:http://www.cnblogs.com/ohio/p/3775949.html