From 5fa16dbd1525e2b476b28291ff55473007d9c1e6 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sat, 15 Aug 2020 17:32:06 +0530 Subject: Force accurate regex match --- nnn.1 | 2 +- src/nnn.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/nnn.1 b/nnn.1 index ec8df82..bf3cf9d 100644 --- a/nnn.1 +++ b/nnn.1 @@ -457,7 +457,7 @@ separated by \fI;\fR: .Pp \fBNNN_ARCHIVE:\fR archive extensions to be handled silently (default: bzip2, (g)zip, tar). .Bd -literal - export NNN_ARCHIVE="(7z|bz2|gz|tar|tgz|zip)$" + export NNN_ARCHIVE="\\\\.(7z|bz2|gz|tar|tgz|zip)$" NOTE: Non-default formats may require a third-party utility. .Ed diff --git a/src/nnn.c b/src/nnn.c index 0b8a778..8a6cb3b 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -663,7 +663,7 @@ static const char * const patterns[] = { "sed -i 's|^\\(\\(.*/\\)\\(.*\\)$\\)|#\\1\\n\\3|' %s", "sed 's|^\\([^#/][^/]\\?.*\\)$|%s/\\1|;s|^#\\(/.*\\)$|\\1|' " "%s | tr '\\n' '\\0' | xargs -0 -n2 sh -c '%s \"$0\" \"$@\" < /dev/tty'", - "(bz|bz2|gz|tar|taz|tbz|tbz2|tgz|z|zip)$", + "\\.(bz|bz2|gz|tar|taz|tbz|tbz2|tgz|z|zip)$", "sed -i 's|^%s\\(.*\\)$|%s\\1|' %s", }; @@ -5975,8 +5975,6 @@ nochange: /* Get the extension for regext match */ tmp = xextension(pent->name, pent->nlen - 1); - if (tmp) - ++tmp; #ifdef PCRE if (tmp && !pcre_exec(archive_pcre, NULL, tmp, pent->nlen - (tmp - pent->name) - 1, 0, 0, NULL, 0)) { -- cgit v1.2.3-70-g09d2