eregex.vim/doc/eregex.jax

481 lines
15 KiB
Plaintext
Raw Normal View History

2010-10-19 05:47:29 -04:00
*eregex.jax*
2010-10-15 10:01:39 -04:00
<20>ե<EFBFBD><D5A5><EFBFBD><EFBFBD><EFBFBD>: eregex.vim, eregex_e.vim
<20><><EFBFBD><EFBFBD>: AKUTSU toshiyuki <locrian@mbd.ocn.ne.jp>
2010-10-19 05:47:29 -04:00
<20>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 2.56
2010-10-15 10:01:39 -04:00
ɬ<>פʤ<D7A4><CAA4><EFBFBD>: Vim version 6.1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹߡ<CAB9>
<20><><EFBFBD><EFBFBD>: eregex.vim <20>ϡ<EFBFBD><CFA1><EFBFBD>ĥ<EFBFBD><C4A5><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD> Vim <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>
eregex_e.vim <20>ϡ<EFBFBD>eregex.vim <20>Υ<EFBFBD><CEA5>ޥ<EFBFBD><DEA5>ɤ<EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>
1. <20><><EFBFBD>ѵ<EFBFBD><D1B5><EFBFBD> |eregex-license-to-use|
2. <20><><EFBFBD>󥹥ȡ<F3A5B9A5><C8A1><EFBFBD> |eregex-installations|
3. <20>ؿ<EFBFBD> |eregex-functions|
4. <20><><EFBFBD>ޥ<EFBFBD><DEA5><EFBFBD> |eregex-commands|
5. <20>Ȥ<EFBFBD><C8A4><EFBFBD> |eregex-examples|
6. <20><><EFBFBD><EFBFBD><EFBFBD>ޥå<DEA5> |eregex-keymappings|
7. <20><>§ |eregex-principle|
8. <20><><EFBFBD><EFBFBD>Ū<EFBFBD><C5AA><EFBFBD>Ѵ<EFBFBD><D1B4><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |eregex-table|
9. <20>ü<EFBFBD><C3BC>ʥ<EFBFBD><CAA5>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5>ȥ<EFBFBD> |eregex-options|
10. <20>ޥ<EFBFBD><DEA5><EFBFBD><EFBFBD><EFBFBD><E9A5A4> |eregex-multiline|
11. <20>ǥ<EFBFBD><C7A5>ߥ<EFBFBD><DFA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |eregex-limitation-of-delimiter|
12. Vim <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>ˤĤ<CBA4><C4A4><EFBFBD> |eregex-about-vimregex|
==============================================================================
1. <20><><EFBFBD>ѵ<EFBFBD><D1B5><EFBFBD> *eregex-license-to-use*
eregex.vim <20><> eregex_e.vim <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϡ<EFBFBD><CFA1><EFBFBD><EFBFBD>ԤǤ<D4A4><C7A4><EFBFBD> AKUTSU toshiyuki <20><>
<20><>°<EFBFBD><C2B0><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۤϼ<DBA4>ͳ<EFBFBD>ˤ<EFBFBD><CBA4>Ƥ<EFBFBD><C6A4>ޤ<EFBFBD><DEA4>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD>
# GPL <20>Ȥ<EFBFBD>ʬ<EFBFBD><CAAC><EFBFBD><EFBFBD><EFBFBD>ʤ<EFBFBD><CAA4>Τ<EFBFBD><CEA4><EFBFBD>(^^ )>>
<20><><EFBFBD>Ԥ<EFBFBD><D4A4>ܥ<EFBFBD><DCA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ץ<EFBFBD>(eregex.vim, eregex_e.vim) <20><><EFBFBD><EFBFBD><EFBFBD>Ѥ<EFBFBD><D1A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥˤ<C8A4><CBA4>ä<EFBFBD><C3A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<20><><EFBFBD><EFBFBD><EFBFBD>ʤ<EFBFBD>»<EFBFBD><C2BB><EFBFBD>ˤĤ<CBA4><C4A4>ơ<EFBFBD><C6A1><EFBFBD><EFBFBD>ڤ<EFBFBD><DAA4><EFBFBD>Ǥ<EFBFBD><C7A4><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD>
==============================================================================
2. <20><><EFBFBD>󥹥ȡ<F3A5B9A5><C8A1><EFBFBD> *eregex-installations*
<20><><EFBFBD><EFBFBD> |add-plugin|
(1) UNIX/Linux
$HOME/.vim/plugin/eregex.vim
$HOME/.vim/plugin/eregex_e.vim
$HOME/.vim/doc/eregex_j.txt
<20><><EFBFBD><EFBFBD><EFBFBD><E9A1A2><EFBFBD>Τ<CEA4>ˤ<EFBFBD><CBA4><EFBFBD> helptags <20>κƹ<CEBA><C6B9>ۤ򤷤ޤ<F2A4B7A4><DEA4><EFBFBD>
:helptags ~/.vim/doc
<20><><EFBFBD><EFBFBD><EFBFBD>ǡ<EFBFBD>:h :E2v <20>Ȥ<EFBFBD><C8A4>Ǥ<EFBFBD><C7A4>ޤ<EFBFBD><DEA4><EFBFBD>
(2) MS-Windows
eregex_j.txt <20><> EUC-JP <20>Ǥ<EFBFBD><C7A4><EFBFBD>
MS-Windows <20>ξ<EFBFBD><CEBE><EFBFBD><EFBFBD><EFBFBD>ͽ<EFBFBD><CDBD> ShiftJIS <20>ˤ<EFBFBD><CBA4>Ƥ<EFBFBD><C6A4><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
%HOME%\vimfiles\plugin\eregex.vim
%HOME%\vimfiles\plugin\eregex_e.vim
%HOME%\vimfiles\doc\eregex_j.txt
<20>ޤ<EFBFBD><DEA4>ϡ<EFBFBD>
%VIM%\vimfiles\plugin\eregex.vim
%VIM%\vimfiles\plugin\eregex_e.vim
%VIM%\vimfiles\doc\eregex_j.vim
<20><><EFBFBD><EFBFBD><EFBFBD><E9A1A2><EFBFBD>Τ<CEA4>ˤ<EFBFBD><CBA4><EFBFBD> helptags <20>κƹ<CEBA><C6B9>ۤ򤷤ޤ<F2A4B7A4><DEA4><EFBFBD>
:helptags $HOME\vimfiles\doc
<20>ޤ<EFBFBD><DEA4>ϡ<EFBFBD>
:helptags $VIM\vimfiles\doc
<20><><EFBFBD><EFBFBD><EFBFBD>ǡ<EFBFBD>:h :E2v <20>Ȥ<EFBFBD><C8A4>Ǥ<EFBFBD><C7A4>ޤ<EFBFBD><DEA4><EFBFBD>
==============================================================================
3. <20>ؿ<EFBFBD> *eregex-functions* *eregex*
*E2v()*
E2v({extendedregex} [, {iISCDMm}])
<20>֤<EFBFBD><D6A4>ͤ<EFBFBD> Vim <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>Ǥ<EFBFBD><C7A4><EFBFBD>
>
:let vimregex = E2v('(?<=abc),\d+,(?=xzy)','i')
:echo vimregex
\c\%(abc\)\@<=,\d\+,\%(xzy\)\@=
<
<20><><EFBFBD>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ξܤ<CEBE><DCA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |eregex-options| <20><> |eregex-multiline|
<20>򸫤Ƥ<F2B8ABA4><C6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
E2v("","V")
<20>֤<EFBFBD><D6A4>ͤ<EFBFBD> eregex.vim <20>ΥС<CEA5><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǥ<EFBFBD><C7A4><EFBFBD>
>
:echo E2v('','V')
248
<
E2v({replacement}, {R1,R2,R3})
<20><><EFBFBD><EFBFBD><EFBFBD>ϡ<EFBFBD>:S/pattern/to/ <20><> "to" <20><><EFBFBD><EFBFBD>ʬ<EFBFBD>ǻȤ<C7BB>ʸ<EFBFBD><CAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><D6A4>ޤ<EFBFBD><DEA4><EFBFBD>
>
E2v('\r,\n,\&,&,\~,~', 'R1') => \n,\r,\&,&,\~,~
E2v('\r,\n,\&,&,\~,~', 'R2') => \r,\n,&,\&,~,\~
E2v('\r,\n,\&,&,\~,~', 'R3') => \n,\r,&,\&,~,\~
<
==============================================================================
4. <20><><EFBFBD>ޥ<EFBFBD><DEA5><EFBFBD> *eregex-commands*
*:E2v*
:[range]E2v [iISCDMm]
Extended regex To Vim regex.
Replace each extended-regex in [range] with vim-style-regex.
*:M*
:M/eregex[/{offset} [iISCDMm]]
Match
:M/<span class="foo">.*?<\/span>/Im
==> /\C<span class="foo">\_.\{-}<\/span>
*:S*
:[range]S/{eregex}/{string}/[&cegpriISCDMm]
Substitute
:'<,'>S/(\d{1,3})(?=(\d\d\d)+($|\D))/\1,/g
==> :'<,'>s/\(\d\{1,3}\)\%(\(\d\d\d\)\+\($\|\D\)\)\@=/\1,/g
*:G* *:G!*
:[range]G/{eregex}/{command}
:[range]G!/{eregex}/{command}
Global
:G/<<-(["'])?EOD\1/,/^\s*EOD\>/:left 8
==> :g/<<-\(["']\)\=EOD\1/,/^\s*EOD\>/:left 8
*:V*
:[range]V/{eregex}/{command}
Vglobal
==============================================================================
5. <20>Ȥ<EFBFBD><C8A4><EFBFBD> *eregex-examples*
(1) :E2v <20><><EFBFBD>ޥ<EFBFBD><DEA5><EFBFBD>
<20><><EFBFBD>γ<EFBFBD>ĥ<EFBFBD><C4A5><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>ιԤ˥<D4A4><CBA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><D6A4><EFBFBD>
(\d{1,3})(?=(\d\d\d)+($|\D))
<20><><EFBFBD>ǡ<EFBFBD>:E2v <20><><EFBFBD>¹Ԥ<C2B9><D4A4><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>Τ<CEA4>ˤʤ롣
\(\d\{1,3}\)\%(\(\d\d\d\)\+\($\|\D\)\)\@=
(2) :M <20><><EFBFBD>ޥ<EFBFBD><DEA5><EFBFBD>
>
:M/<Items\s+attr="media">.+?<\/Items>/Im
<
:normal! /\C<Items[ \t\r\n^L]\+attr="media">\_.\{-1,}<\/Items>
<Items attr="media">
<item name="cdrom" price="90" />
<item name="cdrw" price="500" />
<item name="dvd" price="1000" />
</Items>
(3) :S <20><><EFBFBD>ޥ<EFBFBD><DEA5><EFBFBD>
>
:'<,'>S/(\d{1,3})(?=(\d\d\d)+($|\D))/\1,/g
<
:'<,'>s/\(\d\{1,3}\)\%(\(\d\d\d\)\+\($\|\D\)\)\@=/\1,/g
1 --> 1
12 --> 12
123 --> 123
1234 --> 1,234
12345 --> 12,345
123456 --> 123,456
1234567 --> 1,234,567
12345678 --> 12,345,678
123456789 --> 123,456,789
(4) :G <20><><EFBFBD>ޥ<EFBFBD><DEA5><EFBFBD>
>
:G/^begin$/+1;/^end$/-1:S/\l+/\U&/g
<
:g/^begin$/+1;/^end$/-1:s/\l\+/\U&/g
begin
hello world.
hello world wide web.
hello The Internet.
end
|begin
| HELLO WORLD.
| HELLO WORLD WIDE WEB.
| HELLO THE INTERNET.
|end
(5) :V <20><><EFBFBD>ޥ<EFBFBD><DEA5><EFBFBD>
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ά<EFBFBD><CEAC>
==============================================================================
6. <20><><EFBFBD><EFBFBD><EFBFBD>ޥå<DEA5> *eregex-keymappings*
/ <20>ǹԤʤ<D4A4><CAA4>̾<EFBFBD><CCBE>θ<EFBFBD><CEB8><EFBFBD><EFBFBD><EFBFBD> :M/ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؤ<EFBFBD><D8A4>
.vimrc <20>˰ʲ<CBB0><CAB2><EFBFBD><EFBFBD>񤯡<EFBFBD> ( MS-Windows <20>ξ<EFBFBD><CEBE><EFBFBD> _vimrc <20><> _gvimrc )
nnoremap / :M/
nnoremap ,/ /
"/" <20>ǡ<EFBFBD>:M/ <20>ˤʤꡢ",/" <20>ǽ<EFBFBD><C7BD><EFBFBD><EFBFBD><EFBFBD> "/" <20><><EFBFBD>Ȥ<EFBFBD><C8A4>ޤ<EFBFBD><DEA4><EFBFBD>
--------------------
~/.vimrc <20><><EFBFBD><EFBFBD><EFBFBD>ˡ<EFBFBD>
let eregex_replacement=3
<20><><EFBFBD>񤤤Ƥ<F1A4A4A4><C6A4><EFBFBD><EFBFBD><EFBFBD> :S <20><><EFBFBD>ޥ<EFBFBD><DEA5>ɤ<EFBFBD>ư<EFBFBD><EFBFBD><EEA4AC><EFBFBD>Τ<CEA4><E8A4A6><EFBFBD>Ѥ<EFBFBD><D1A4><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>
:S/pattern/\r,\n,\&,&,\~,~/
:s/pattern/\n,\r,&,\&,~,\~/
+--------------------+-----------------------------+
| eregex_replacement | :S/pattern/\n,\r,&,\&,~,\~/ |
+--------------------+-----------------------------+
| 0 | :s/pattern/\n,\r,&,\&,~,\~/ |
| 1 | :s/pattern/\r,\n,&,\&,~,\~/ |
| 2 | :s/pattern/\n,\r,\&,&,\~,~/ |
| 3 | :s/pattern/\r,\n,\&,&,\~,~/ |
+--------------------+-----------------------------+
==============================================================================
7. <20><>§ *eregex-principle*
eregex.vim <20>ˤ<EFBFBD><CBA4><EFBFBD><EFBFBD>ơ<EFBFBD>
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>סַ<D7A1><D6B7><EFBFBD><EFBFBD>֤<EFBFBD><D6A4>סִݥ<D6B4><DDA5>å<EFBFBD><C3A5>פϡ<D7A4><CFA1><EFBFBD>ĥ<EFBFBD><C4A5><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD>ή <20><><EFBFBD><EFBFBD><EFBFBD>Ѥ<EFBFBD><D1A4>
<20><><EFBFBD><EFBFBD><EFBFBD>ʳ<EFBFBD><CAB3><EFBFBD> Vim <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>˽<EFBFBD><CBBD><EFBFBD><EFBFBD><EFBFBD>
==============================================================================
8. <20><><EFBFBD><EFBFBD>Ū<EFBFBD><C5AA><EFBFBD>Ѵ<EFBFBD><D1B4><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *eregex-table*
<20><><EFBFBD>ˤϳ<CBA4>ĥ<EFBFBD><C4A5><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD><EFBFBD>񤭡<EFBFBD><F1A4ADA1><EFBFBD><EFBFBD>ˤ<EFBFBD> Vim ή<><CEAE><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD>('magic')<29><><EFBFBD>񤯡<EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
--------------------
:M/a|b /a\|b
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD>
--------------------
:M/a* /a*
:M/a+ /a\+
:M/a? /a\=
:M/a*? /a\{-}
:M/a+? /a\{-1,}
:M/a?? /a\{-,1}
:M/a{3,5} /a\{3,5}
:M/a{3,} /a\{3,}
:M/a{,5} /a\{,5}
:M/a{3,5}? /a\{-3,5}
:M/a{3,}? /a\{-3,}
:M/a{,5}? /a\{-,5}
<EFBFBD>ݥ<EFBFBD><EFBFBD>å<EFBFBD>(<28>ѥ<EFBFBD><D1A5><EFBFBD>)
--------------------
:M/(abc) /\(abc\)
:M/(?:abc) /\%(abc\)
:M/(?<=abc) /\%(abc\)\@<=
:M/(?<!abc) /\%(abc\)\@<!
:M/(?=abc) /\%(abc\)\@=
:M/(?!abc) /\%(abc\)\@!
:M/(?>abc) /\%(abc\)\@>
ʸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Τ<EFBFBD><EFBFBD><EFBFBD>
--------------------
:M/\\,\|,\(,\),\{,\},\?,\+,\*,\[,\] /\\,|,(,),{,},?,+,\*,\[,\]
:M/\^,\$ /\^,\$
<EFBFBD><EFBFBD>ĥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><EFBFBD><EFBFBD>ǻȤ<EFBFBD><EFBFBD>ʤ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
--------------------
\A, \b, \B, \G, \Z, \z
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Vim <20>Τ<EFBFBD><CEA4>ΤȤ<CEA4><C8A4>ư<EFBFBD><C6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
(?i:a) <20><> (?-i) <20>ʤɤ<CAA4><C9A4>Ȥ<EFBFBD><C8A4>ʤ<EFBFBD><CAA4><EFBFBD>
Vim <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>ǻȤ<C7BB><C8A4>ʤ<EFBFBD><CAA4><EFBFBD><EFBFBD><EFBFBD>
--------------------
\%(re\) <20><><EFBFBD><EFBFBD><EFBFBD>ѥ<EFBFBD><D1A5><EFBFBD>(<28>ݥ<EFBFBD><DDA5>å<EFBFBD>) <20><><EFBFBD>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̡<EFBFBD>
~ matches the last given substitute string
\m 'magic' on for the following chars in the pattern
\M 'magic' off for the following chars in the pattern
\v the following chars in the pattern are "very magic"
\V the following chars in the pattern are "very nomagic"
\x hex digit: [0-9A-Fa-f]
\\x[0-9A-Fa-f]{1,2} <20>ξ<EFBFBD><CEBE>硢ʸ<E7A1A2><CAB8><EFBFBD><EFBFBD><EFBFBD>Τ<EFBFBD><CEA4>Τ<EFBFBD><CEA4>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD>
\x82\xa0 => '<27><>' ( shift-jis, cp932 )
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0x00 <20><> 0x0a <20><> 0x08 <20><><EFBFBD>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD>
Vim <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>ǻȤ<C7BB><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
--------------------
<20><><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4>ޤ<EFBFBD><DEA4><EFBFBD>(^^;)
\d, \D, \w, \W, \s, \S, \a, \A, \u, \U, \b, ...
\<, \>, \zs, \ze
\_[a-z], \%[abc], [[:alpha:]], \_., \_^, \_$
\%23l, \%23c, \%23v, \%#
<20>ʤɡ<CAA4>
==============================================================================
9. <20>ü<EFBFBD><C3BC>ʥ<EFBFBD><CAA5>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5>ȥ<EFBFBD> *eregex-options*
Note: "^L" <20><> \x0c
eregex.vim Vim
---------------------------------------
:M/a/i /\ca/
:M/\ca/ /\ca/
:M/a/I /\Ca/
:M/\Ca/ /\Ca/
:M/\s/S /[ \t\r\n^L]
:M/\S/S /[^ \t\r^L]
:M/[^az]/C /\_[^az]/
:M/\W/C /\_W/
:M/./D /\_./
:M/\s[^az]./M /[ \t\r\n^L]\_[^az]./
:M/\s[^az].\M/ Ʊ<>
:M/\s[^az]./m /[ \t\r\n^L]\_[^az]\_./
:M/\s[^az].\m/ Ʊ<>
+--------+------+--------------------------------------------------------+
| OPTION | ATOM | <20><><EFBFBD><EFBFBD> |
+--------+------+--------------------------------------------------------+
| /i | \c | <20>羮ʸ<E7BEAE><CAB8><EFBFBD>ζ<EFBFBD><CEB6><EFBFBD>̵<EFBFBD><CCB5><EFBFBD><EFBFBD> |
| /I | \C | <20>羮ʸ<E7BEAE><CAB8><EFBFBD>ζ<EFBFBD><CEB6>̤<EFBFBD><CCA4>ꡣ |
+--------+------+--------------------------------------------------------+
| /S | | \s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \S <20><> [ \t\r\n^L] <20><> [^ \t\r^L] <20><><EFBFBD>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD>롣 |
| /C | | <20><EFBFBD><EFBFBD><E7A4AC><EFBFBD>Ԥˤ<D4A4><CBA4>ޥå<DEA5><C3A5><EFBFBD><EFBFBD>롣 |
| /D | | <20>ɥåȤ<C3A5><C8A4><EFBFBD><EFBFBD>Ԥˤ<D4A4><CBA4>ޥå<DEA5><C3A5><EFBFBD><EFBFBD>롣 |
+--------+------+--------------------------------------------------------+
| /M | \M | /S <20><> /C <20><><EFBFBD>Ԥʤ<D4A4><CAA4><EFBFBD> <20><>ʬ<EFBFBD>ޥ<EFBFBD><DEA5><EFBFBD><EFBFBD><EFBFBD><E9A5A4><EFBFBD><EFBFBD> |
| /m | \m | /S <20><> /C <20><> /D <20><><EFBFBD>Ԥʤ<D4A4><CAA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޥ<EFBFBD><DEA5><EFBFBD><EFBFBD><EFBFBD><E9A5A4><EFBFBD><EFBFBD> |
+--------+------+--------------------------------------------------------+
Note:
(A) <20><><EFBFBD>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD><EFBFBD> /iImM
(B) \c, \C, \m, \M
(C) (?i), (?I), (?m), (?M)
<20><><EFBFBD><EFBFBD><EFBFBD>餬Ʊ<E9A4AC><C6B1><EFBFBD>˻<EFBFBD><CBBB><EFBFBD>줿<EFBFBD><ECA4BF><EFBFBD><EFBFBD><E7A1A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͥ<EFBFBD><CDA5><EFBFBD><EFBFBD><EFBFBD>̤<EFBFBD><CCA4><EFBFBD><E2A4A4>
<20><><EFBFBD>ʤߤˡ<DFA4>(?M) <20><> (?m) <20>ϡ<EFBFBD><CFA1>֥饱<D6A5>åȤ<C3A5><C8A4><EFBFBD><EFBFBD><EFBFBD> \s <20>ˤ<EFBFBD>Ŭ<EFBFBD>Ѥ<EFBFBD><D1A4><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD>
==============================================================================
10. <20>ޥ<EFBFBD><DEA5><EFBFBD><EFBFBD><EFBFBD><E9A5A4> *eregex-multiline*
<20>Ȥꤢ<C8A4><EAA4A2><EFBFBD><EFBFBD><EFBFBD>ʲ<EFBFBD><CAB2><EFBFBD>ɽ<EFBFBD>򸫤ơ<F2B8ABA4>(^^;)
+-----+----------------------------------------------+--------------------+
| Num | eregex.vim => vim regex | ruby regex |
+-----+----------------------------------------------+--------------------+
| (1) | :M/a\s[^az].z/ => /a\s[^az].z/ | /a[ \t][^az\n].z/ |
+-----+----------------------------------------------+--------------------+
| | :M/a\s[^az].z/S => /a[ \t\r\n^L][^az].z/ | /a\s[^az\n].z/ |
| | :M/a\s[^az].z/C => /a\s\_[^az].z/ | /a[ \t][^az].z/ |
| | :M/a\s[^az].z/D => /a\s[^az]\_.z/ | /a[ \t][^az\n].z/m |
+-----+----------------------------------------------+--------------------+
| (2) | :M/a\s[^az].z/M => /a[ \t\r\n^L]\_[^az].z/ | /a\s[^az].z/ |
| (3) | :M/a\s[^az].z/m => /a[ \t\r\n^L]\_[^az]\_.z/ | /a\s[^az].z/m |
+-----+----------------------------------------------+--------------------+
(1) <20>ϡ<EFBFBD><CFA1><EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>פ<EFBFBD> Vim ή<><CEAE>
(2) <20>ϡ<EFBFBD><CFA1><EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>פ<EFBFBD> Ruby ή<><CEAE>
Vim ή<>˸<EFBFBD><CBB8><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>Ԥ˥ޥå<DEA5><C3A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EAA4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Τǡ<CEA4><C7A1><EFBFBD>ʬ<EFBFBD>ޥ<EFBFBD><DEA5><EFBFBD><EFBFBD><EFBFBD><E9A5A4><EFBFBD><EFBFBD>
Ruby ή<>˸<EFBFBD><CBB8><EFBFBD><EFBFBD>С<EFBFBD><D0A1>ޥ<EFBFBD><DEA5><EFBFBD><EFBFBD><EFBFBD><E9A5A4><EFBFBD>Ǥʤ<C7A4><CAA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>äƥ<C3A4><C6A5>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD><EFBFBD> M <20><>
(3) <20>ϡ<EFBFBD><CFA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ruby ή<>Υޥ<CEA5><DEA5><EFBFBD><EFBFBD><EFBFBD><E9A5A4><EFBFBD><EFBFBD>
Note:
Vim <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>Ǥϡ<C7A4>/[^az]/ <20>ϲ<EFBFBD><CFB2>Ԥ˥ޥå<DEA5><C3A5><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD>
<20><><EFBFBD>Ԥ˥ޥå<DEA5><C3A5><EFBFBD><EFBFBD>ʤ<EFBFBD><CAA4><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> /[^az\n]/ <20>Ƚ<EFBFBD><C8BD><EFBFBD>ɬ<EFBFBD>פϤ<D7A4><CFA4><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD>
/[^az\n]/ <20>ϰտޤ<D5BF>ȿ<EFBFBD><C8BF><EFBFBD>Ʋ<EFBFBD><C6B2>Ԥˤ<D4A4><CBA4>ޥå<DEA5><C3A5><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>
<20><><EFBFBD>äơ<C3A4><C6A1><EFBFBD><EFBFBD><EFBFBD> /[^ \t\r\n^L]/ <20>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD>٤<EFBFBD><D9A4>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/[^ \t\r^L]/ <20><>
<20>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E7A4AC><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>
<20><>§Ū<C2A7><C5AA> Vim <20>Ǥϡ<C7A4>[^...] <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \n <20><><EFBFBD>񤤤ƤϤ<C6A4><CFA4><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD>
==============================================================================
11. <20>ǥ<EFBFBD><C7A5>ߥ<EFBFBD><DFA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *eregex-limitation-of-delimiter*
2010-10-19 05:47:29 -04:00
:M <20>ǻȤ<C7BB><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڤ<EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD><EFBFBD> / <20><> ? <20><><EFBFBD><EFBFBD><EFBFBD>Ǥ<EFBFBD><C7A4><EFBFBD>
2010-10-15 10:01:39 -04:00
:S <20><>:G <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> :V <20>ǻȤ<C7BB><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڤ<EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD><EFBFBD> /, #, @ <20>Ǥ<EFBFBD><C7A4><EFBFBD>
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>ˡ<EFBFBD><CBA1> :s <20><>:g <20><>:v <20><>Ʊ<EFBFBD><C6B1><EFBFBD>Ǥ<EFBFBD><C7A4><EFBFBD>
<20><><EFBFBD>¤<EFBFBD>Ʊ<EFBFBD>ͤǤ<CDA4><C7A4><EFBFBD>
<20><><EFBFBD>ڤ<EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD><EFBFBD> @ <20>ˤ<EFBFBD><CBA4><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¤<EFBFBD><C2A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>
<20><EFBFBD><ECB8AB><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˸<EFBFBD><CBB8><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
"foo@bar.baz.co.jp" <20><> "foo@hoge.co.jp" <20><><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4>ơ<EFBFBD>
>
:%s@\<foo\@bar\.baz\.co\.jp\>@foo\@hoge.co.jp@Ig
<
<20>ϡ<EFBFBD><CFA1><EFBFBD><EFBFBD><EFBFBD>Ǥ<EFBFBD><C7A4><EFBFBD>
Vim <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>ǡ<EFBFBD>\@ <20><><EFBFBD><EFBFBD><EFBFBD>̤ʰ<CCA4><CAB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4>ޤ<EFBFBD><DEA4><EFBFBD>
==============================================================================
12. Vim <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>ˤĤ<CBA4><C4A4><EFBFBD> *eregex-about-vimregex*
<20>ʲ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "111,222,333" <20>ιԤ<CEB9><D4A4>֤<EFBFBD><D6A4>ơ<EFBFBD>:S... <20><><EFBFBD>¹Ԥ<C2B9><D4A4>Ƥ<EFBFBD><C6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
(1)<29>̾<EFBFBD><CCBE>Υ<EFBFBD><CEA5>֥ޥå<DEA5><C3A5><EFBFBD>
111,222,333
>
:S/(\d+),(\d+),(\d+)/\=submatch(1) + submatch(2) + submatch(3)
<
666
(2)Vim <20>ȼ<EFBFBD><C8BC><EFBFBD>ǽ<EFBFBD><C7BD>
<20>ޥå<DEA5><C3A5>ǡ<EFBFBD><C7A1><EFBFBD>($&, &, matchdata) <20>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>֥ޥå<DEA5><C3A5><EFBFBD>ʬΥ<CAAC>Ǥ<EFBFBD><C7A4>ޤ<EFBFBD><DEA4><EFBFBD>
\zs <20><> \ze <20><><EFBFBD>Ȥ<EFBFBD><C8A4><EFBFBD> See :h /\zs
111,222,333
>
:S/(\d+),\zs\d+\ze,(\d+)/\=submatch(1) + submatch(0) + submatch(2)
<
111,666,333
(3)
<20>ʲ<EFBFBD><CAB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʬ<EFBFBD><CAAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4A4B9><EFBFBD><EFBFBD><EFBFBD>
111,222,333
>
:S/(\d+),\zs(\d+)\ze,(\d+)/\=submatch(1) + submatch(2) + submatch(3)
<
111,666,333
\zs <20><> \ze <20><><EFBFBD>Ȥ<EFBFBD><C8A4>ȡ<EFBFBD><C8A1>ޥå<DEA5><C3A5>ǡ<EFBFBD><C7A1><EFBFBD><EFBFBD>˴ޤޤ<DEA4><DEA4>ʤ<EFBFBD><CAA4><EFBFBD><EFBFBD>֥ޥå<DEA5><C3A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǥ<EFBFBD><C7A4>ޤ<EFBFBD><DEA4><EFBFBD>
(4) \_x <20>ε<EFBFBD>ǽ<EFBFBD><C7BD>
\u <20><> [A-Z] <20><>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD>
\_u <20><> [A-Z\n] <20><>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD>
\_[A-Z] <20><> [A-Z\n] <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>
<20><>ʸ<EFBFBD><CAB8><EFBFBD>ʳ<EFBFBD><CAB3>Dz<EFBFBD><C7B2>Ԥ<EFBFBD><D4A4>ޤ<EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD><EFBFBD>
\_U == \_[^A-Z]
\_. <20>ϲ<EFBFBD><CFB2>Ԥ<EFBFBD><D4A4>ޤ<EFBFBD>Ǥ<EFBFBD>դ<EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD><EFBFBD>
(5) ^ <20><> \_^ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> $ <20><> \_$ <20>ΰ㤤<CEB0><E3A4A4>
$ <20><><EFBFBD><EFBFBD><EFBFBD>ˤȤ<CBA4><C8A4>ޤ<EFBFBD><DEA4><EFBFBD>
<20>̾<EFBFBD> $ <20><>
(1)<29><><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>ΰ<EFBFBD><CEB0>ֺǸ塣
(2) ) <20><>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD>
(3) | <20><>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD>
<20>ˤ<EFBFBD><CBA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD>
<20>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD>Ǥ<EFBFBD>դξ<D5A4><CEBE><EFBFBD><EFBFBD>ǹ<EFBFBD><C7B9><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD><EFBFBD>Τ<EFBFBD> \_$ <20><>
111,222,333
>
:S/(\d+),(\d+),(\d+)\zs\_$\ze/\=',' . (submatch(1) + submatch(2) + submatch(3))
<
111,222,333,666
<20><><EFBFBD><EFBFBD><EFBFBD>ǻȤäƤ<C3A4><C6A4><EFBFBD> \_$ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> $ <20><><EFBFBD>ȤäƤ<C3A4><C6A4>տޤ<D5BF><DEA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̤ˤʤ<CBA4><CAA4>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD>
Note:
\_^ <20><> \_$ <20><> perl <20><> /m <20><><EFBFBD>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>
==============================================================================
13. <20><><EFBFBD><EFBFBD>
revision 2.55
(1) E2v() <20>˥С<CBA5><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9>䡢sub-replace-special <20><><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD>ä<EFBFBD><C3A4><EFBFBD><EFBFBD><EFBFBD>
(2) \v <20><> 0x0b <20><><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˤ<EFBFBD><CBA4><EFBFBD><EFBFBD><EFBFBD>
(3) :M/pattern/ <20>ǥޥå<DEA5><C3A5><EFBFBD><EFBFBD>ʤ<EFBFBD><CAA4>Ƥ⡢@/ <20>򹹿<EFBFBD><F2B9B9BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
revision 2.35
(1) <20><><EFBFBD>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD><EFBFBD> S,C,D,M,m <20><><EFBFBD>ɲä<C9B2><C3A4>ѹ<EFBFBD><D1B9><EFBFBD>
revision 1.4x
(1) :S/\x2f/\\/g <20>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>:s///\\/g <20><><EFBFBD>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4>ޤ<EFBFBD><DEA4>Х<EFBFBD><D0A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
(2) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>פ<EFBFBD><D7A4>줿<EFBFBD>ǥ<EFBFBD><C7A5>ߥ<EFBFBD><DFA5>򸡺<EFBFBD><F2B8A1BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǥϥ<C7A4><CFA5>󥨥<EFBFBD><F3A5A8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>פ<EFBFBD><D7A4><EFBFBD><EFBFBD><EFBFBD>
<20>ǥ<EFBFBD><C7A5>ߥ<EFBFBD><DFA5><EFBFBD> '@' <20>ξ<EFBFBD><CEBE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
(3) <20><><EFBFBD>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD><EFBFBD> m <20>ν<EFBFBD><CEBD><EFBFBD><EFBFBD><EFBFBD>
revision 1.13
:G <20><> ! <20><><EFBFBD>Ȥ<EFBFBD><C8A4><EFBFBD><EFBFBD><EFBFBD>ˤ<EFBFBD><CBA4><EFBFBD><EFBFBD><EFBFBD>
revision 1.1.1.21
:S <20><> /c <20><><EFBFBD>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>dz<EFBFBD>ǧ<EFBFBD>Υץ<CEA5><D7A5><EFBFBD><EFBFBD>ץȤ<D7A5><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʤ<EFBFBD><CAA4>ʤäƤ<C3A4><C6A4>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD><EABDA4><EFBFBD><EFBFBD>
-- vim:ft=help: