差别
这里会显示出您选择的修订版和当前版本之间的差别。
| 两侧同时换到之前的修订记录 前一修订版 后一修订版 | 前一修订版 | ||
| public:it:regular-expressions [2014/08/04 13:25] – oakfire | public:it:regular-expressions [2022/04/07 17:40] (当前版本) – oakfire | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| ====== Regular Expressions ====== | ====== Regular Expressions ====== | ||
| + | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| * 在线正则测试: | * 在线正则测试: | ||
| 行 7: | 行 7: | ||
| * [[http:// | * [[http:// | ||
| * [[http:// | * [[http:// | ||
| + | * [[http:// | ||
| * 在线编辑正则: | * 在线编辑正则: | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| * [[http:// | * [[http:// | ||
| * [[http:// | * [[http:// | ||
| * [[http:// | * [[http:// | ||
| + | * duckduckgo.com' | ||
| + | Anchors | ||
| + | ^ Start of string or line | ||
| + | \A Start of string | ||
| + | $ End of string or line | ||
| + | \Z End of string | ||
| + | \b Word boundary | ||
| + | \B Not word boundary | ||
| + | \< Start of word | ||
| + | \> End of word | ||
| + | Character Classes | ||
| + | \c Control character | ||
| + | \s Whitespace | ||
| + | \S Not Whitespace | ||
| + | \d Digit | ||
| + | \D Not digit | ||
| + | \w Word | ||
| + | \W Not Word | ||
| + | \x Hexadecimal digit | ||
| + | \O Octal Digit | ||
| + | POSIX Classes | ||
| + | [: | ||
| + | [: | ||
| + | [: | ||
| + | [: | ||
| + | [: | ||
| + | [: | ||
| + | [: | ||
| + | [: | ||
| + | [: | ||
| + | [: | ||
| + | [: | ||
| + | [: | ||
| + | [: | ||
| + | Pattern Modifiers | ||
| + | //g Global Match (all occurrences) | ||
| + | // | ||
| + | // | ||
| + | //s Treat string as single line | ||
| + | //x Allow comments and whitespace | ||
| + | // | ||
| + | // | ||
| + | Escape Sequences | ||
| + | \ Escape following character | ||
| + | \Q Begin literal sequence | ||
| + | \E End literal sequence | ||
| + | Quantifiers | ||
| + | * 0 or more | ||
| + | + 1 or more | ||
| + | ? 0 or 1 (optional) | ||
| + | {3} Exactly 3 | ||
| + | {3,} 3 or more | ||
| + | {2,5} 2, 3, 4 or 5 | ||
| + | Groups and Ranges | ||
| + | . Any character except newline (\n) | ||
| + | (a|b) a or b | ||
| + | (...) Group | ||
| + | (?: | ||
| + | [abc] Single character (a or b or c) | ||
| + | [^abc] Single character (not a or b or c) | ||
| + | [a-q] Single character range (a or b ... or q) | ||
| + | [A-Z] Single character range (A or B ... or Z) | ||
| + | [0-9] Single digit from 0 to 9 | ||
| + | Assertions | ||
| + | ? | ||
| + | ?! Negative lookahead | ||
| + | ?< | ||
| + | ?!= or ?< | ||
| + | ?> | ||
| + | ? | ||
| + | ? | ||
| + | ?# Comment | ||
| + | Special Characters | ||
| + | \n New line | ||
| + | \r Carriage return | ||
| + | \t Tab | ||
| + | \v Vertical tab | ||
| + | \f Form feed | ||
| + | \ooo Octal character ooo | ||
| + | \xhh Hex character hh | ||
| + | String Replacement | ||
| + | $n n-th non-passive group | ||
| + | $2 " | ||
| + | $1 " | ||
| + | $` Before matched string | ||
| + | $' | ||
| + | $+ Last matched string | ||
| + | $& | ||
| + | </ | ||
| + | |||