Mercurial > vim
comparison src/testdir/test80.in @ 5794:a63d0cd691dc v7.4.241
updated for version 7.4.241
Problem: The string returned by submatch() does not distinguish between a
NL from a line break and a NL that stands for a NUL character.
Solution: Add a second argument to return a list. (ZyX)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 02 Apr 2014 19:00:58 +0200 |
parents | d59544f3022b |
children | 219dbe63ad2a |
comparison
equal
deleted
inserted
replaced
5793:3b08d14e08a3 | 5794:a63d0cd691dc |
---|---|
125 STARTTEST | 125 STARTTEST |
126 :set magic& | 126 :set magic& |
127 :set cpo& | 127 :set cpo& |
128 :$put =\"\n\nTEST_5:\" | 128 :$put =\"\n\nTEST_5:\" |
129 :$put =substitute('A123456789', 'A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', '\=submatch(0) . submatch(9) . submatch(8) . submatch(7) . submatch(6) . submatch(5) . submatch(4) . submatch(3) . submatch(2) . submatch(1)', '') | 129 :$put =substitute('A123456789', 'A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', '\=submatch(0) . submatch(9) . submatch(8) . submatch(7) . submatch(6) . submatch(5) . submatch(4) . submatch(3) . submatch(2) . submatch(1)', '') |
130 :$put =substitute('A123456789', 'A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', '\=string([submatch(0, 1), submatch(9, 1), submatch(8, 1), submatch(7, 1), submatch(6, 1), submatch(5, 1), submatch(4, 1), submatch(3, 1), submatch(2, 1), submatch(1, 1)])', '') | |
130 /^TEST_6 | 131 /^TEST_6 |
131 ENDTEST | 132 ENDTEST |
132 | 133 |
133 TEST_6: | 134 TEST_6: |
134 | 135 |
151 :set cpo& | 152 :set cpo& |
152 :$put =\"\n\nTEST_7:\" | 153 :$put =\"\n\nTEST_7:\" |
153 :$put =substitute('A | 154 :$put =substitute('A |
154 A', 'A.', '\=submatch(0)', '') | 155 A', 'A.', '\=submatch(0)', '') |
155 :$put =substitute(\"B\nB\", 'B.', '\=submatch(0)', '') | 156 :$put =substitute(\"B\nB\", 'B.', '\=submatch(0)', '') |
157 :$put =substitute(\"B\nB\", 'B.', '\=string(submatch(0, 1))', '') | |
156 :$put =substitute('-bb', '\zeb', 'a', 'g') | 158 :$put =substitute('-bb', '\zeb', 'a', 'g') |
157 :$put =substitute('-bb', '\ze', 'c', 'g') | 159 :$put =substitute('-bb', '\ze', 'c', 'g') |
158 /^TEST_8 | 160 /^TEST_8 |
159 ENDTEST | 161 ENDTEST |
160 | 162 |