1
- *pattern.txt* For Vim version 8.0 . Last change: 2017 Mar 05
1
+ *pattern.txt* For Vim version 8.1 . Last change: 2018 Mar 13
2
2
3
3
4
4
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -905,7 +905,7 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
905
905
becomes invalid. Vim doesn't automatically update the matches.
906
906
Similar to moving the cursor for "\%#" | /\%# | .
907
907
908
- */\%l* */\%>l* */\%<l*
908
+ */\%l* */\%>l* */\%<l* *E951*
909
909
\%23l Matches in a specific line.
910
910
\%<23l Matches above a specific line (lower line number).
911
911
\%>23l Matches below a specific line (higher line number).
@@ -1076,34 +1076,40 @@ x A single character, with no special meaning, matches itself
1076
1076
":s/[/x/" searches for "[/x" and replaces it with nothing. It does
1077
1077
not search for "[" and replaces it with "x"!
1078
1078
1079
+ *E944* *E945*
1079
1080
If the sequence begins with "^", it matches any single character NOT
1080
1081
in the collection: "[^xyz]" matches anything but 'x', 'y' and 'z'.
1081
1082
- If two characters in the sequence are separated by '-', this is
1082
1083
shorthand for the full list of ASCII characters between them. E.g.,
1083
- "[0-9]" matches any decimal digit. Non-ASCII characters can be
1084
- used, but the character values must not be more than 256 apart.
1084
+ "[0-9]" matches any decimal digit. If the starting character exceeds
1085
+ the ending character, e.g. [c-a] , E944 occurs. Non-ASCII characters
1086
+ can be used, but the character values must not be more than 256 apart
1087
+ in the old regexp engine. For example, searching by [\u3000-\u4000]
1088
+ after setting re=1 emits a E945 error. Prepending \%#=2 will fix it.
1085
1089
- A character class expression is evaluated to the set of characters
1086
1090
belonging to that character class. The following character classes
1087
1091
are supported:
1088
- Name Contents ~
1089
- *[:alnum:]* [:alnum:] ASCII letters and digits
1090
- *[:alpha:]* [:alpha:] ASCII letters
1091
- *[:blank:]* [:blank:] space and tab characters
1092
- *[:cntrl:]* [:cntrl:] control characters
1093
- *[:digit:]* [:digit:] decimal digits
1094
- *[:graph:]* [:graph:] printable characters excluding space
1095
- *[:lower:]* [:lower:] lowercase letters (all letters when
1092
+ Name Func Contents ~
1093
+ *[:alnum:]* [:alnum:] isalnum ASCII letters and digits
1094
+ *[:alpha:]* [:alpha:] isalpha ASCII letters
1095
+ *[:blank:]* [:blank:] space and tab
1096
+ *[:cntrl:]* [:cntrl:] iscntrl ASCII control characters
1097
+ *[:digit:]* [:digit:] decimal digits '0' to '9'
1098
+ *[:graph:]* [:graph:] isgraph ASCII printable characters excluding
1099
+ space
1100
+ *[:lower:]* [:lower:] (1) lowercase letters (all letters when
1096
1101
'ignorecase' is used)
1097
- *[:print:]* [:print:] printable characters including space
1098
- *[:punct:]* [:punct:] ASCII punctuation characters
1099
- *[:space:]* [:space:] whitespace characters
1100
- *[:upper:]* [:upper:] uppercase letters (all letters when
1102
+ *[:print:]* [:print:] (2) printable characters including space
1103
+ *[:punct:]* [:punct:] ispunct ASCII punctuation characters
1104
+ *[:space:]* [:space:] whitespace characters: space, tab, CR,
1105
+ NL, vertical tab, form feed
1106
+ *[:upper:]* [:upper:] (3) uppercase letters (all letters when
1101
1107
'ignorecase' is used)
1102
- *[:xdigit:]* [:xdigit:] hexadecimal digits
1103
- *[:return:]* [:return:] the <CR> character
1104
- *[:tab:]* [:tab:] the <Tab> character
1105
- *[:escape:]* [:escape:] the <Esc> character
1106
- *[:backspace:]* [:backspace:] the <BS> character
1108
+ *[:xdigit:]* [:xdigit:] hexadecimal digits: 0-9, a-f, A-F
1109
+ *[:return:]* [:return:] the <CR> character
1110
+ *[:tab:]* [:tab:] the <Tab> character
1111
+ *[:escape:]* [:escape:] the <Esc> character
1112
+ *[:backspace:]* [:backspace:] the <BS> character
1107
1113
The brackets in character class expressions are additional to the
1108
1114
brackets delimiting a collection. For example, the following is a
1109
1115
plausible pattern for a UNIX filename: "[-./[:alnum:]_~]\+" That is,
@@ -1114,6 +1120,13 @@ x A single character, with no special meaning, matches itself
1114
1120
regexp engine. See | two-engines | . In the future these items may
1115
1121
work for multi-byte characters. For now, to get all "alpha"
1116
1122
characters you can use: [[:lower:][:upper:]].
1123
+
1124
+ The "Func" column shows what library function is used. The
1125
+ implementation depends on the system. Otherwise:
1126
+ (1) Uses islower() for ASCII and Vim builtin rules for other
1127
+ characters when built with the | +multi_byte | feature.
1128
+ (2) Uses Vim builtin rules
1129
+ (3) As with (1) but using isupper()
1117
1130
*/[[=* *[==]*
1118
1131
- An equivalence class. This means that characters are matched that
1119
1132
have almost the same meaning, e.g., when ignoring accents. This
@@ -1153,7 +1166,8 @@ x A single character, with no special meaning, matches itself
1153
1166
- Matching with a collection can be slow, because each character in
1154
1167
the text has to be compared with each character in the collection.
1155
1168
Use one of the other atoms above when possible. Example: "\d" is
1156
- much faster than "[0-9]" and matches the same characters.
1169
+ much faster than "[0-9]" and matches the same characters. However,
1170
+ the new | NFA | regexp engine deals with this better than the old one.
1157
1171
1158
1172
*/\%[]* *E69* *E70* *E369*
1159
1173
\%[] A sequence of optionally matched atoms. This always matches.
0 commit comments