-
viはPOSIX BRE +
\<
,\>
,~
-
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ex.html#tag_20_40_13_58
-
ただし
\{
,\}
はSUSv2 (1997) 以降? -
4.4BSD (1994) のviには
\{
,\}
は含まれないようである -
nviは
\{
,\}
を実装していない -
the traditional vi (2004) は
\{
,\}
を実装している -
illumos viは
\{
,\}
をサポートしているようである
-
-
vimはviを拡張した独自構文(
\{n,m\}
の構文は異なる) -
IdeaVim, VsVimはおそらくvim互換(VsVimは.Net正規表現で表現できる範囲まで?)
-
evilはemacsの正規表現をそのまま使用する(viの拡張版。vimとは互換性なし。置換文字列の特殊文字も
replace-match
のものをそのまま使うのでviとは異なり&
ではなく\&
になる) -
vscodevimはECMAScriptの正規表現をそのまま使用する(viと互換性なし)
-
set extended
でPOSIX EREベースの正規表現が使えるviもあったようである
Last active
August 13, 2022 23:54
-
-
Save leque/062ab0f0173daceaf355a433016efc77 to your computer and use it in GitHub Desktop.
vi(m)クローンの正規表現比較
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vi | vim | evil (emacs) | vscodevim | |
---|---|---|---|---|
正規表現 | ||||
RE* | RE*, RE\{} | RE* | RE* | |
RE\+ | RE+ | RE+ | ||
RE\=, RE\? | RE? | RE? | ||
RE\{n,m\} | RE\{n,m} | RE\{n,m\} | RE{n,m} | |
RE\{n} | RE\{n\} | RE{n} | ||
RE\{n,} | RE\{n,\} | RE{n,} | ||
RE\{,m} | RE\{,m\} | RE{,m} | ||
RE\{-n,m} | RE{n,m}? | |||
RE\{-n} | RE{n}? | |||
RE\{-n,} | RE{n,}? | |||
RE\{-,m} | RE{,m}? | |||
RE\{-} | RE*? | RE*? | ||
RE\@> | ||||
RE\@= | (?=RE) | |||
RE\@! | (?!RE) | |||
RE\@<= | (?<=RE) | |||
RE\@<! | (?<!RE) | |||
\( \) | \( \) | \( \) | ( ) | |
\| | \| | | | ||
^ | ^ | ^ | ^ | |
$ | $ | $ | $ | |
. | . | . | . | |
\< | \< | \< | \b | |
\> | \> | \> | \b | |
置換文字列 | ||||
& | & | \& | $& | |
\0 | ||||
\1 \2 ... \9 | \1 \2 ... \9 | \1 \2 ... \9 | $1 $2 ... $9 | |
\u | \u | |||
\U | \U | |||
\l | \l | |||
\L | \L | |||
\e | \e | |||
\E | \E | |||
\r | ||||
\n | ||||
\t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment