comparison runtime/doc/pattern.txt @ 840:2c885fab04e3 v7.0e06

updated for version 7.0e06
author vimboss
date Sat, 22 Apr 2006 22:33:57 +0000
parents 5117153003bd
children a209672376fd
comparison
equal deleted inserted replaced
839:1f3b1021f002 840:2c885fab04e3
1 *pattern.txt* For Vim version 7.0e. Last change: 2006 Apr 02 1 *pattern.txt* For Vim version 7.0e. Last change: 2006 Apr 22
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
338 atom ::= ordinary-atom |/ordinary-atom| 338 atom ::= ordinary-atom |/ordinary-atom|
339 or \( pattern \) |/\(| 339 or \( pattern \) |/\(|
340 or \%( pattern \) |/\%(| 340 or \%( pattern \) |/\%(|
341 or \z( pattern \) |/\z(| 341 or \z( pattern \) |/\z(|
342 342
343
344 ==============================================================================
345 3. Magic */magic*
346
347 Some characters in the pattern are taken literally. They match with the same
348 character in the text. When preceded with a backslash however, these
349 characters get a special meaning.
350
351 Other characters have a special meaning without a backslash. They need to be
352 preceded with a backslash to match literally.
353
354 If a character is taken literally or not depends on the 'magic' option and the
355 items mentioned next.
356 */\m* */\M*
357 Use of "\m" makes the pattern after it be interpreted as if 'magic' is set,
358 ignoring the actual value of the 'magic' option.
359 Use of "\M" makes the pattern after it be interpreted as if 'nomagic' is used.
360 */\v* */\V*
361 Use of "\v" means that in the pattern after it all ASCII characters except
362 '0'-'9', 'a'-'z', 'A'-'Z' and '_' have a special meaning. "very magic"
363
364 Use of "\V" means that in the pattern after it only the backslash has a
365 special meaning. "very nomagic"
366
367 Examples:
368 after: \v \m \M \V matches ~
369 'magic' 'nomagic'
370 $ $ $ \$ matches end-of-line
371 . . \. \. matches any character
372 * * \* \* any number of the previous atom
373 () \(\) \(\) \(\) grouping into an atom
374 | \| \| \| separating alternatives
375 \a \a \a \a alphabetic character
376 \\ \\ \\ \\ literal backslash
377 \. \. . . literal dot
378 \{ { { { literal '{'
379 a a a a literal 'a'
380
381 {only Vim supports \m, \M, \v and \V}
382
383 It is recommended to always keep the 'magic' option at the default setting,
384 which is 'magic'. This avoids portability problems. To make a pattern immune
385 to the 'magic' option being set or not, put "\m" or "\M" at the start of the
386 pattern.
343 387
344 ============================================================================== 388 ==============================================================================
345 4. Overview of pattern items *pattern-overview* 389 4. Overview of pattern items *pattern-overview*
346 390
347 Overview of multi items. */multi* *E61* *E62* 391 Overview of multi items. */multi* *E61* *E62*
481 with almost the same definition as the ")" command. 525 with almost the same definition as the ")" command.
482 526
483 cat\Z Both "cat" and "càt" ("a" followed by 0x0300) 527 cat\Z Both "cat" and "càt" ("a" followed by 0x0300)
484 Does not match "càt" (character 0x00e0), even 528 Does not match "càt" (character 0x00e0), even
485 though it may look the same. 529 though it may look the same.
486
487
488 ==============================================================================
489 3. Magic */magic*
490
491 Some characters in the pattern are taken literally. They match with the same
492 character in the text. When preceded with a backslash however, these
493 characters get a special meaning.
494
495 Other characters have a special meaning without a backslash. They need to be
496 preceded with a backslash to match literally.
497
498 If a character is taken literally or not depends on the 'magic' option and the
499 items mentioned next.
500 */\m* */\M*
501 Use of "\m" makes the pattern after it be interpreted as if 'magic' is set,
502 ignoring the actual value of the 'magic' option.
503 Use of "\M" makes the pattern after it be interpreted as if 'nomagic' is used.
504 */\v* */\V*
505 Use of "\v" means that in the pattern after it all ASCII characters except
506 '0'-'9', 'a'-'z', 'A'-'Z' and '_' have a special meaning. "very magic"
507
508 Use of "\V" means that in the pattern after it only the backslash has a
509 special meaning. "very nomagic"
510
511 Examples:
512 after: \v \m \M \V matches ~
513 'magic' 'nomagic'
514 $ $ $ \$ matches end-of-line
515 . . \. \. matches any character
516 * * \* \* any number of the previous atom
517 () \(\) \(\) \(\) grouping into an atom
518 | \| \| \| separating alternatives
519 \a \a \a \a alphabetic character
520 \\ \\ \\ \\ literal backslash
521 \. \. . . literal dot
522 \{ { { { literal '{'
523 a a a a literal 'a'
524
525 {only Vim supports \m, \M, \v and \V}
526
527 It is recommended to always keep the 'magic' option at the default setting,
528 which is 'magic'. This avoids portability problems. To make a pattern immune
529 to the 'magic' option being set or not, put "\m" or "\M" at the start of the
530 pattern.
531 530
532 531
533 ============================================================================== 532 ==============================================================================
534 5. Multi items *pattern-multi-items* 533 5. Multi items *pattern-multi-items*
535 534