vi: use basic regular expressions for search
Both traditional vi and vim use basic regular expressions for search. Also, they don't allow matches to extend across line endings. Thus with the file: 123 234 the search '/2.*4$' should find the second '2', not the first. Make BusyBox vi do the same. Whether or not VI_REGEX_SEARCH is enabled: function old new delta ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0) Total: 0 bytes 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>
This commit is contained in:
parent
b50ac07cba
commit
2916443ab6
@ -2378,9 +2378,9 @@ static char *char_search(char *p, const char *pat, int dir_and_range)
|
|||||||
char *q;
|
char *q;
|
||||||
int i, size, range, start;
|
int i, size, range, start;
|
||||||
|
|
||||||
re_syntax_options = RE_SYNTAX_POSIX_EXTENDED;
|
re_syntax_options = RE_SYNTAX_POSIX_BASIC & (~RE_DOT_NEWLINE);
|
||||||
if (ignorecase)
|
if (ignorecase)
|
||||||
re_syntax_options = RE_SYNTAX_POSIX_EXTENDED | RE_ICASE;
|
re_syntax_options |= RE_ICASE;
|
||||||
|
|
||||||
memset(&preg, 0, sizeof(preg));
|
memset(&preg, 0, sizeof(preg));
|
||||||
err = re_compile_pattern(pat, strlen(pat), &preg);
|
err = re_compile_pattern(pat, strlen(pat), &preg);
|
||||||
|
Loading…
Reference in New Issue
Block a user