diff options
author | Denys Vlasenko | 2021-07-13 14:38:20 +0200 |
---|---|---|
committer | Denys Vlasenko | 2021-07-13 14:38:20 +0200 |
commit | 95ac4a48f17c2fdd2a10524c0b399e3be72d8f42 (patch) | |
tree | 7877669d7835524e1152dfa890dc189faad61dc1 /shell/ash_test/ash-vars/var-pattern-replacement-in-parameter-expansion-2.right | |
parent | c76c78740a19ed3b1f9c5910313460221096536a (diff) | |
download | busybox-95ac4a48f17c2fdd2a10524c0b399e3be72d8f42.zip busybox-95ac4a48f17c2fdd2a10524c0b399e3be72d8f42.tar.gz |
vi: allow regular expressions in ':s' commands
BusyBox vi has never supported the use of regular expressions in
search/replace (':s') commands. Implement this using GNU regex
when VI_REGEX_SEARCH is enabled.
The implementation:
- uses basic regular expressions, to match those used in the search
command;
- only supports substitution of back references ('\0' - '\9') in the
replacement string. Any other character following a backslash is
treated as that literal character.
VI_REGEX_SEARCH isn't enabled in the default build. In that case:
function old new delta
colon 4036 4033 -3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-3) Total: -3 bytes
When VI_REGEX_SEARCH is enabled:
function old new delta
colon 4036 4378 +342
.rodata 108207 108229 +22
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 364/0) Total: 364 bytes
v2: Rebase. Code shrink. Ensure empty replacement string is null terminated.
Signed-off-by: Andrey Dobrovolsky <andrey.dobrovolsky.odessa@gmail.com>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash_test/ash-vars/var-pattern-replacement-in-parameter-expansion-2.right')
0 files changed, 0 insertions, 0 deletions