comparison runtime/doc/pattern.txt @ 23164:99ef85ff1af4

Update runtime files. Commit: https://github.com/vim/vim/commit/1b884a0053982335f644eec6c71027706bf3c522 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Dec 10 21:11:27 2020 +0100 Update runtime files.
author Bram Moolenaar <Bram@vim.org>
date Thu, 10 Dec 2020 21:15:05 +0100
parents d4c7b3e9cd17
children 15fa3923cc49
comparison
equal deleted inserted replaced
23163:ab4a692918ec 23164:99ef85ff1af4
1 *pattern.txt* For Vim version 8.2. Last change: 2020 Sep 01 1 *pattern.txt* For Vim version 8.2. Last change: 2020 Dec 06
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
359 or atom multi 359 or atom multi
360 360
361 */atom* 361 */atom*
362 5. An atom can be one of a long list of items. Many atoms match one character 362 5. An atom can be one of a long list of items. Many atoms match one character
363 in the text. It is often an ordinary character or a character class. 363 in the text. It is often an ordinary character or a character class.
364 Braces can be used to make a pattern into an atom. The "\z(\)" construct 364 Parentheses can be used to make a pattern into an atom. The "\z(\)"
365 is only for syntax highlighting. 365 construct is only for syntax highlighting.
366 366
367 atom ::= ordinary-atom |/ordinary-atom| 367 atom ::= ordinary-atom |/ordinary-atom|
368 or \( pattern \) |/\(| 368 or \( pattern \) |/\(|
369 or \%( pattern \) |/\%(| 369 or \%( pattern \) |/\%(|
370 or \z( pattern \) |/\z(| 370 or \z( pattern \) |/\z(|
674 "foobarfoo", because it tries match "foo" in the same position where 674 "foobarfoo", because it tries match "foo" in the same position where
675 "bar" matched. 675 "bar" matched.
676 676
677 Note that using "\&" works the same as using "\@=": "foo\&.." is the 677 Note that using "\&" works the same as using "\@=": "foo\&.." is the
678 same as "\(foo\)\@=..". But using "\&" is easier, you don't need the 678 same as "\(foo\)\@=..". But using "\&" is easier, you don't need the
679 braces. 679 parentheses.
680 680
681 681
682 */\@!* 682 */\@!*
683 \@! Matches with zero width if the preceding atom does NOT match at the 683 \@! Matches with zero width if the preceding atom does NOT match at the
684 current position. |/zero-width| 684 current position. |/zero-width|
1067 \x A backslash followed by a single character, with no special meaning, 1067 \x A backslash followed by a single character, with no special meaning,
1068 is reserved for future expansions 1068 is reserved for future expansions
1069 1069
1070 [] (with 'nomagic': \[]) */[]* */\[]* */\_[]* */collection* 1070 [] (with 'nomagic': \[]) */[]* */\[]* */\_[]* */collection*
1071 \_[] 1071 \_[]
1072 A collection. This is a sequence of characters enclosed in brackets. 1072 A collection. This is a sequence of characters enclosed in square
1073 It matches any single character in the collection. 1073 brackets. It matches any single character in the collection.
1074 Example matches ~ 1074 Example matches ~
1075 [xyz] any 'x', 'y' or 'z' 1075 [xyz] any 'x', 'y' or 'z'
1076 [a-zA-Z]$ any alphabetic character at the end of a line 1076 [a-zA-Z]$ any alphabetic character at the end of a line
1077 \c[a-z]$ same 1077 \c[a-z]$ same
1078 [А-яЁё] Russian alphabet (with utf-8 and cp1251) 1078 [А-яЁё] Russian alphabet (with utf-8 and cp1251)
1127 *[:escape:]* [:escape:] the <Esc> character 1127 *[:escape:]* [:escape:] the <Esc> character
1128 *[:backspace:]* [:backspace:] the <BS> character 1128 *[:backspace:]* [:backspace:] the <BS> character
1129 *[:ident:]* [:ident:] identifier character (same as "\i") 1129 *[:ident:]* [:ident:] identifier character (same as "\i")
1130 *[:keyword:]* [:keyword:] keyword character (same as "\k") 1130 *[:keyword:]* [:keyword:] keyword character (same as "\k")
1131 *[:fname:]* [:fname:] file name character (same as "\f") 1131 *[:fname:]* [:fname:] file name character (same as "\f")
1132 The brackets in character class expressions are additional to the 1132 The square brackets in character class expressions are additional to
1133 brackets delimiting a collection. For example, the following is a 1133 the square brackets delimiting a collection. For example, the
1134 plausible pattern for a UNIX filename: "[-./[:alnum:]_~]\+" That is, 1134 following is a plausible pattern for a UNIX filename:
1135 a list of at least one character, each of which is either '-', '.', 1135 "[-./[:alnum:]_~]\+". That is, a list of at least one character,
1136 '/', alphabetic, numeric, '_' or '~'. 1136 each of which is either '-', '.', '/', alphabetic, numeric, '_' or
1137 '~'.
1137 These items only work for 8-bit characters, except [:lower:] and 1138 These items only work for 8-bit characters, except [:lower:] and
1138 [:upper:] also work for multibyte characters when using the new 1139 [:upper:] also work for multibyte characters when using the new
1139 regexp engine. See |two-engines|. In the future these items may 1140 regexp engine. See |two-engines|. In the future these items may
1140 work for multibyte characters. For now, to get all "alpha" 1141 work for multibyte characters. For now, to get all "alpha"
1141 characters you can use: [[:lower:][:upper:]]. 1142 characters you can use: [[:lower:][:upper:]].