460 lines
15 KiB
Plaintext
460 lines
15 KiB
Plaintext
*eregex.txt*
|
||
|
||
File: eregex.vim, eregex_e.vim
|
||
Author: AKUTSU toshiyuki <locrian@mbd.ocn.ne.jp>
|
||
Maintainer: othree <othree@gmail.com>
|
||
Version: 2.56
|
||
Required: Vim version 6.1
|
||
Note: eregex.vim is used to convert regexp notation.
|
||
eregex_e.vim is used to map command for eregex.vim.
|
||
|
||
1. License |eregex-license-to-use|
|
||
2. Installation |eregex-installations|
|
||
3. Functions |eregex-functions|
|
||
4. Command |eregex-commands|
|
||
5. Usage |eregex-examples|
|
||
6. Keymap |eregex-keymappings|
|
||
7. Principle |eregex-principle|
|
||
8. Convert Table |eregex-table|
|
||
9. Options |eregex-options|
|
||
10. Multiline |eregex-multiline|
|
||
11. Limitation of Delimiter |eregex-limitation-of-delimiter|
|
||
12. About Vim RegExp |eregex-about-vimregex|
|
||
|
||
==============================================================================
|
||
1. License *eregex-license-to-use*
|
||
|
||
Copyright of eregex.vim and eregex_e.vim belongs to AKUTSU toshiyuki.
|
||
It is free to change and redistribute this script. You can think as an
|
||
GPL License software.
|
||
|
||
Author will not take any reponsibility for damages due to using this
|
||
script (eregex.vim, eregex_e.vim).
|
||
|
||
==============================================================================
|
||
2. Installation *eregex-installations*
|
||
|
||
Open eregex.vba using Vim. And execute the following command.
|
||
>
|
||
:so %
|
||
<
|
||
|
||
==============================================================================
|
||
3. Functions *eregex-functions* *eregex*
|
||
*E2v()*
|
||
E2v({extendedregex} [, {iISCDMm}])
|
||
|
||
Vim regexp notation will return.
|
||
>
|
||
:let vimregex = E2v('(?<=abc),\d+,(?=xzy)','i')
|
||
:echo vimregex
|
||
\c\%(abc\)\@<=,\d\+,\%(xzy\)\@=
|
||
<
|
||
Detail of option value can be found at |eregex-options|
|
||
or |eregex-multiline|
|
||
|
||
E2v("","V")
|
||
Return eregex.vim version number
|
||
>
|
||
:echo E2v('','V')
|
||
248
|
||
<
|
||
E2v({replacement}, {R1,R2,R3})
|
||
Return the "to" part of :S/pattern/to/ .
|
||
>
|
||
E2v('\r,\n,\&,&,\~,~', 'R1') => \n,\r,\&,&,\~,~
|
||
E2v('\r,\n,\&,&,\~,~', 'R2') => \r,\n,&,\&,~,\~
|
||
E2v('\r,\n,\&,&,\~,~', 'R3') => \n,\r,&,\&,~,\~
|
||
<
|
||
|
||
==============================================================================
|
||
4. Command *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. Usage *eregex-examples*
|
||
|
||
(1) :E2v command
|
||
|
||
Change the regexp notation of the cursor line.
|
||
|
||
(\d{1,3})(?=(\d\d\d)+($|\D))
|
||
|
||
Move cursor to this line and execute :E2v command will change this line to
|
||
the following result.
|
||
|
||
\(\d\{1,3}\)\%(\(\d\d\d\)\+\($\|\D\)\)\@=
|
||
|
||
|
||
(2) :M command
|
||
>
|
||
: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 command
|
||
>
|
||
:'<,'>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 command
|
||
>
|
||
: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 command
|
||
Skipped.
|
||
|
||
==============================================================================
|
||
6. keymap *eregex-keymappings*
|
||
|
||
You can add the following keymap to use / instead of type :/M
|
||
|
||
nnoremap / :M/
|
||
nnoremap ? :M?
|
||
nnoremap ,/ /
|
||
nnoremap ,? /
|
||
|
||
"/" will use :M/ to search. ",/" will use the original "/".
|
||
|
||
--------------------
|
||
Add the following line to ~/.vimrc
|
||
let eregex_replacement=3
|
||
will make :S have the following rules.
|
||
|
||
: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. Principle *eregex-principle*
|
||
eregex.vim adopts the way of extended regex about "alternation",
|
||
"repetition" and "grouping".
|
||
eregex.vim <20>ˤ<EFBFBD><CBA4><EFBFBD><EFBFBD>ơ<EFBFBD>
|
||
|
||
==============================================================================
|
||
8. Convert Table *eregex-table*
|
||
|
||
Perl notation on left side. Vim notation('magic') on right side.
|
||
|
||
Alternation
|
||
--------------------
|
||
:M/a|b /a\|b
|
||
|
||
Repetition
|
||
--------------------
|
||
: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}
|
||
|
||
Grouping
|
||
--------------------
|
||
:M/(abc) /\(abc\)
|
||
:M/(?:abc) /\%(abc\)
|
||
:M/(?<=abc) /\%(abc\)\@<=
|
||
:M/(?<!abc) /\%(abc\)\@<!
|
||
:M/(?=abc) /\%(abc\)\@=
|
||
:M/(?!abc) /\%(abc\)\@!
|
||
:M/(?>abc) /\%(abc\)\@>
|
||
|
||
Special Characters
|
||
--------------------
|
||
:M/\\,\|,\(,\),\{,\},\?,\+,\*,\[,\] /\\,|,(,),{,},?,+,\*,\[,\]
|
||
:M/\^,\$ /\^,\$
|
||
|
||
Not support
|
||
--------------------
|
||
\A, \b, \B, \G, \Z, \z
|
||
Vim doesn't support these features.
|
||
(?i:a) and (?-i) neither.
|
||
|
||
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><EFBF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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*
|
||
|
||
:M <20>ǻȤ<C7BB><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڤ<EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD><EFBFBD> / <20><><EFBFBD><EFBFBD><EFBFBD>Ǥ<EFBFBD><C7A4><EFBFBD>
|
||
:S <20><>:G <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> :V <20>ǻȤ<C7BB><C8A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڤ<EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD><EFBFBD> /, #, @ <20>Ǥ<EFBFBD><C7A4><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A4><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. Changes
|
||
revision 2.56
|
||
(1) Add support for "?"
|
||
|
||
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:
|