Skip to content

Commit 1fe0c19

Browse files
authored
Merge pull request #892 from tsuyoshicho/update/pattern-20210301
Update pattern.{txt.jax}
2 parents 9128c18 + 50350f3 commit 1fe0c19

File tree

2 files changed

+46
-41
lines changed

2 files changed

+46
-41
lines changed

doc/pattern.jax

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*pattern.txt* For Vim バージョン 8.2. Last change: 2020 Dec 06
1+
*pattern.txt* For Vim バージョン 8.2. Last change: 2021 Jan 08
22

33

44
VIMリファレンスマニュアル by Bram Moolenaar
@@ -390,15 +390,18 @@ NFA エンジンが選択され、未実装の機能が使用され、パター
390390
==============================================================================
391391
3. Magic */magic*
392392

393-
パターンの中でリテラルとして扱われる文字は、テキストの同じ文字とマッチします。
394-
しかし、バックスラッシュが前置されると、特別な意味を持つようになります。
393+
パターンの中でリテラル、つまり文字列として扱われる文字は、テキストの同じ文字と
394+
マッチします。しかし、バックスラッシュが前置されると、特別な意味を持つことがあ
395+
ります。
395396

396397
バックスラッシュを前置しなくても特別な意味を持つ文字があります。そのような文字
397398
をリテラル文字としてマッチさせるには、バックスラッシュを前置する必要がありま
398-
す。
399+
す。例えば "." は任意の文字にマッチし "\." はドットにマッチします。
399400

400401
ある文字がリテラルとして処理されるかどうかは、オプション 'magic' と、以下で説
401-
明するアイテムに依存します。
402+
明するパターンに含まれるアイテムに依存します。オプション 'magic' は常に設定す
403+
るべきですが、Vi 互換のためにオフにすることができます。ここでは網羅性のために
404+
'nomagic' の効果を説明しますが、使用については推奨しません。
402405
*/\m* */\M*
403406
"\m" を使うと、それ以降のパターンは 'magic' がオンの状態で処理されます。
404407
オプション 'magic' の設定よりも優先されます。
@@ -413,23 +416,22 @@ ASCII文字は特別な意味を持ちます: "very magic"
413416
例:
414417
after: \v \m \M \V マッチするもの ~
415418
'magic' 'nomagic'
416-
$ $ $ \$ 行末
419+
a a a a リテラルの 'a'
420+
\a \a \a \a 何かの英字 1 文字
417421
. . \. \. 何か 1 文字
422+
\. \. . . リテラルのドット
423+
$ $ $ \$ 行末
418424
* * \* \* 直前のアトムの繰り返し
419425
~ ~ \~ \~ 直近の置換文字列
420-
() \(\) \(\) \(\) グループ化してアトムにする
421-
| \| \| \| 選択の区切り
422-
\a \a \a \a 英字
426+
() \(\) \(\) \(\) アトムとしてグループ化
427+
| \| \| \| マッチ無し: 選択の区切り
423428
\\ \\ \\ \\ リテラルのバックスラッシュ
424-
\. \. . . リテラルのドット
425-
\{ { { { リテラルの '{'
426-
a a a a リテラルの 'a'
429+
\{ { { { リテラルの波カッコ
427430

428431
{\m、\M、\v、\V、はVimだけの機能です}
429432

430-
オプション 'magic' は初期設定のままにしておいてください。環境の違いによるトラ
431-
ブルを回避できます。パターンが 'magic' の設定に影響されないようにするには、パ
432-
ターンの先頭に "\m" か "\M" を置きます。
433+
パターンが 'magic' の設定に影響されないよう望むなら、パターンの先頭に "\m" か
434+
"\M" を置きます。
433435

434436

435437
==============================================================================
@@ -1161,7 +1163,7 @@ x 特別な意味のない文字は、その文字自身とマッチします
11611163
\b <BS>
11621164
\n 改行。|/[\n]| 参照。
11631165
\d123 10進数の文字番号
1164-
\o40 8 進数の文字番号 (最大値 0377)
1166+
\o40 8 進数の文字番号 (最大値 0o377)
11651167
\x20 16進数の文字番号 (最大値 0xff)
11661168
\u20AC 16進数のマルチバイト文字番号 (最大値 0xffff)
11671169
\U1234 16進数のマルチバイト文字番号 (最大値 0xffffffff)
@@ -1198,9 +1200,9 @@ x 特別な意味のない文字は、その文字自身とマッチします
11981200

11991201
\%d123 10進数で指定した文字にマッチします。このアトムの後ろには数字以外の文字
12001202
を置いてください。
1201-
\%o40 8 進数で指定した文字にマッチします (最大値 0377)。040 より小さい値を指
1202-
定するとき、このアトムの後ろには8進数字以外の文字か、数字以外の文字を
1203-
置いてください
1203+
\%o40 8 進数で指定した文字にマッチします (最大値 0377)。0o40 より小さい値を
1204+
指定するとき、このアトムの後ろには8進数字以外の文字か、数字以外の文字
1205+
を置いてください
12041206
\%x2a 16進数で指定した文字にマッチします。2桁まで。
12051207
\%u20AC 16進数で指定した文字にマッチします。4桁まで。
12061208
\%U1234abcd 16進数で指定した文字にマッチします。8桁まで。0x7fffffff まで。

en/pattern.txt

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*pattern.txt* For Vim version 8.2. Last change: 2020 Dec 06
1+
*pattern.txt* For Vim version 8.2. Last change: 2021 Jan 08
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -394,15 +394,19 @@ the pattern will not match. This is only useful when debugging Vim.
394394
==============================================================================
395395
3. Magic */magic*
396396

397-
Some characters in the pattern are taken literally. They match with the same
398-
character in the text. When preceded with a backslash however, these
399-
characters get a special meaning.
397+
Some characters in the pattern, such as letters, are taken literally. They
398+
match exactly the same character in the text. When preceded with a backslash
399+
however, these characters may get a special meaning. For example, "a" matches
400+
the letter "a", while "\a" matches any alphabetic character.
400401

401402
Other characters have a special meaning without a backslash. They need to be
402-
preceded with a backslash to match literally.
403+
preceded with a backslash to match literally. For example "." matches any
404+
character while "\." matches a dot.
403405

404406
If a character is taken literally or not depends on the 'magic' option and the
405-
items mentioned next.
407+
items in the pattern mentioned next. The 'magic' option should always be set,
408+
but it can be switched off for Vi compatibility. We mention the effect of
409+
'nomagic' here for completeness, but we recommend against using that.
406410
*/\m* */\M*
407411
Use of "\m" makes the pattern after it be interpreted as if 'magic' is set,
408412
ignoring the actual value of the 'magic' option.
@@ -411,30 +415,28 @@ Use of "\M" makes the pattern after it be interpreted as if 'nomagic' is used.
411415
Use of "\v" means that after it, all ASCII characters except '0'-'9', 'a'-'z',
412416
'A'-'Z' and '_' have special meaning: "very magic"
413417

414-
Use of "\V" means that after it, only a backslash and terminating character
415-
(usually / or ?) have special meaning: "very nomagic"
418+
Use of "\V" means that after it, only a backslash and the terminating
419+
character (usually / or ?) have special meaning: "very nomagic"
416420

417421
Examples:
418422
after: \v \m \M \V matches ~
419423
'magic' 'nomagic'
420-
$ $ $ \$ matches end-of-line
421-
. . \. \. matches any character
424+
a a a a literal 'a'
425+
\a \a \a \a any alphabetic character
426+
. . \. \. any character
427+
\. \. . . literal dot
428+
$ $ $ \$ end-of-line
422429
* * \* \* any number of the previous atom
423430
~ ~ \~ \~ latest substitute string
424-
() \(\) \(\) \(\) grouping into an atom
425-
| \| \| \| separating alternatives
426-
\a \a \a \a alphabetic character
431+
() \(\) \(\) \(\) group as an atom
432+
| \| \| \| nothing: separates alternatives
427433
\\ \\ \\ \\ literal backslash
428-
\. \. . . literal dot
429-
\{ { { { literal '{'
430-
a a a a literal 'a'
434+
\{ { { { literal curly brace
431435

432436
{only Vim supports \m, \M, \v and \V}
433437

434-
It is recommended to always keep the 'magic' option at the default setting,
435-
which is 'magic'. This avoids portability problems. To make a pattern immune
436-
to the 'magic' option being set or not, put "\m" or "\M" at the start of the
437-
pattern.
438+
If you want to you can make a pattern immune to the 'magic' option being set
439+
or not by putting "\m" or "\M" at the start of the pattern.
438440

439441
==============================================================================
440442
4. Overview of pattern items *pattern-overview*
@@ -1177,7 +1179,7 @@ x A single character, with no special meaning, matches itself
11771179
\b <BS>
11781180
\n line break, see above |/[\n]|
11791181
\d123 decimal number of character
1180-
\o40 octal number of character up to 0377
1182+
\o40 octal number of character up to 0o377
11811183
\x20 hexadecimal number of character up to 0xff
11821184
\u20AC hex. number of multibyte character up to 0xffff
11831185
\U1234 hex. number of multibyte character up to 0xffffffff
@@ -1215,7 +1217,8 @@ x A single character, with no special meaning, matches itself
12151217
\%d123 Matches the character specified with a decimal number. Must be
12161218
followed by a non-digit.
12171219
\%o40 Matches the character specified with an octal number up to 0377.
1218-
Numbers below 040 must be followed by a non-octal digit or a non-digit.
1220+
Numbers below 0o40 must be followed by a non-octal digit or a
1221+
non-digit.
12191222
\%x2a Matches the character specified with up to two hexadecimal characters.
12201223
\%u20AC Matches the character specified with up to four hexadecimal
12211224
characters.

0 commit comments

Comments
 (0)