Lines Matching refs:pattern
1 *pattern.txt* For Vim version 8.2. Last change: 2021 Jul 16
7 Patterns and search commands *pattern-searches*
13 2. The definition of a pattern |search-pattern|
15 4. Overview of pattern items |pattern-overview|
16 5. Multi items |pattern-multi-items|
17 6. Ordinary atoms |pattern-atoms|
18 7. Ignoring case in a pattern |/ignorecase|
28 /{pattern}[/]<CR> Search forward for the [count]'th occurrence of
29 {pattern} |exclusive|.
31 /{pattern}/{offset}<CR> Search forward for the [count]'th occurrence of
32 {pattern} and go |{offset}| lines up or down.
37 latest used pattern |last-pattern| with latest used
41 latest used pattern |last-pattern| with new
45 ?{pattern}[?]<CR> Search backward for the [count]'th previous
46 occurrence of {pattern} |exclusive|.
48 ?{pattern}?{offset}<CR> Search backward for the [count]'th previous
49 occurrence of {pattern} and go |{offset}| lines up or
54 latest used pattern |last-pattern| with latest used
58 latest used pattern |last-pattern| with new
65 |last-pattern|
69 opposite direction. |last-pattern|
147 While typing the search pattern the current match will be shown if the
152 All matches for the last used search pattern will be highlighted if you set
172 These commands search for the specified pattern. With "/" and "?" an
186 ;{pattern} perform another search, see |//;|
194 pattern cursor position ~
205 An example of how to search for matches with a pattern and change the match
230 *last-pattern*
231 The last used pattern and offset are remembered. They can be used to repeat
234 substitute command ":s". Each time an empty pattern is given, the previously
235 used pattern is used. However, if there is no previous search command, a
236 previous substitute pattern is used, if possible.
238 The 'magic' option sticks with the last used pattern. If you change 'magic',
239 this will not change how the last used pattern will be interpreted.
241 will result in the pattern to match other text.
243 All matches for the last used search pattern will be highlighted if you set
246 To clear the last used search pattern: >
248 This will not set the pattern to an empty string, because that would match
249 everywhere. The pattern is really cleared, like when starting Vim.
263 In Vi the ":tag" command sets the last search pattern when the tag is searched
264 for. In Vim this is not done, the previous search pattern is still remembered,
265 unless the 't' flag is present in 'cpoptions'. The search pattern is always
271 'wrapscan' is set and the pattern was not found the error message "pattern
309 when executing a pattern takes a long time and when checking for messages on
310 channels a callback is invoked that also uses a pattern or an autocommand is
311 triggered. In most cases this should be fine, but if a pattern is in use when
313 the pattern.
316 2. The definition of a pattern *search-pattern* *pattern* *[pattern]*
322 */bar* */\bar* */pattern*
323 1. A pattern is one or more branches, separated by "\|". It matches anything
327 pattern ::= branch
365 Parentheses can be used to make a pattern into an atom. The "\z(\)"
369 or \( pattern \) |/\(|
370 or \%( pattern \) |/\%(|
371 or \z( pattern \) |/\z(|
382 prepend one of the following to the pattern:
393 the pattern will not match. This is only useful when debugging Vim.
398 Some characters in the pattern, such as letters, are taken literally. They
408 items in the pattern mentioned next. The 'magic' option should always be set,
412 Use of "\m" makes the pattern after it be interpreted as if 'magic' is set,
414 Use of "\M" makes the pattern after it be interpreted as if 'nomagic' is used.
439 If you want to you can make a pattern immune to the 'magic' option being set
440 or not by putting "\m" or "\M" at the start of the pattern.
443 4. Overview of pattern items *pattern-overview*
469 |/\@>| \@> \@> 1, like matching a whole pattern
481 |/^| ^ ^ start-of-line (at start of pattern) |/zero-width|
484 |/$| $ $ end-of-line (at end of pattern) |/zero-width|
561 |/\m| \m \m 'magic' on for the following chars in the pattern
562 |/\M| \M \M 'magic' off for the following chars in the pattern
563 |/\v| \v \v the following chars in the pattern are "very magic"
564 |/\V| \V \V the following chars in the pattern are "very nomagic"
583 [.!?][])"']*\($\|[ ]\) A search pattern that finds the end of a sentence,
592 5. Multi items *pattern-multi-items*
608 Exception: When "*" is used at the start of the pattern or just after
668 Like "(?=pattern)" in Perl.
688 Like "(?!pattern)" in Perl.
695 Using "\@!" is tricky, because there are many places where a pattern
710 < This pattern first checks that there is not a single position in the
712 reject the pattern. When there is no match any "foo" will be found.
718 Like "(?<=pattern)" in Perl, but Vim allows non-fixed-width patterns.
733 In the old regexp engine the part of the pattern after "\@<=" and
747 of matches that are known to fail and make executing the pattern very
762 Like "(?<!pattern)" in Perl, but Vim allows non-fixed-width patterns.
773 matches that are known to fail and make executing the pattern very
777 \@> Matches the preceding atom like matching a whole pattern.
778 Like "(?>pattern)" in Perl.
783 This matches the preceding atom as if it was a pattern by itself. If
792 6. Ordinary atoms *pattern-atoms*
797 ^ At beginning of pattern or after "\|", "\(", "\%(" or "\n": matches
803 \^ Matches literal '^'. Can be used at any position in the pattern, but
808 the pattern, but not inside [].
814 $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
819 \$ Matches literal '$'. Can be used at any position in the pattern, but
824 pattern, but not inside []. Note that "a\_$b" never matches, since
892 This is a |/zero-width| match. To make sure the whole pattern is
894 the pattern, e.g.: >
904 WARNING: When the cursor is moved after the pattern was used, the
924 WARNING: When the mark is moved after the pattern was used, the result
1071 \(\) A pattern enclosed by escaped parentheses. */\(* */\(\)* */\)*
1082 in the pattern (going left to right), NOT based on what is matched
1085 \%(\) A pattern enclosed by escaped parentheses. */\%(\)* */\%(* *E53*
1116 `:substitute` command the whole command becomes the pattern. E.g.
1159 following is a plausible pattern for a UNIX filename:
1252 7. Ignoring case in a pattern */ignorecase*
1255 'smartcase' can be set to ignore case when the pattern contains lowercase
1258 When "\c" appears anywhere in the pattern, the whole pattern is handled like
1260 ignored. "\C" does the opposite: Force matching case for the whole pattern.
1265 pattern 'ignorecase' 'smartcase' matches ~
1276 files. To match a <Nul> with a search pattern you can just enter CTRL-@ or
1278 character is replaced with a <NL> in the search pattern. What is unusual is
1287 When working with expression evaluation, a <NL> character in the pattern
1291 *pattern-multi-byte* *pattern-multibyte*
1293 expect. But invalid bytes may cause trouble, a pattern with an invalid byte
1300 When "\Z" appears anywhere in the pattern, all composing characters are
1304 Exception: If the pattern starts with one or more composing characters, these
1307 Use "\%C" to skip any composing characters. For example, the pattern "a" does
1313 When a composing character appears at the start of the pattern or after an
1322 more composing characters than the pattern, it still matches. But all
1323 composing characters in the pattern must be found in the text.
1326 pattern text match ~
1361 a pattern using the same syntax used for the i flag above, BTW.)
1374 - changing the magic-ness of a pattern: \v \V \m \M
1386 :mat[ch] {group} /{pattern}/
1387 Define a pattern to highlight in the current window. It will
1392 end of the {pattern}. Watch out for using special characters,
1403 Note that highlighting the last used search pattern with
1404 'hlsearch' is used in all windows, while the pattern defined
1408 'ignorecase' does not apply, use |/\c| in the pattern to
1411 'redrawtime' defines the maximum time searched for pattern
1419 the highlight group and pattern of a previous |:match|
1440 Clear a previously defined match pattern.
1443 :2mat[ch] {group} /{pattern}/ *:2match*
1446 :3mat[ch] {group} /{pattern}/ *:3match*