Force accurate regex match

This commit is contained in:
Arun Prakash Jana 2020-08-15 17:32:06 +05:30
parent 7d672411bb
commit 5fa16dbd15
2 changed files with 2 additions and 4 deletions

2
nnn.1
View File

@ -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

View File

@ -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)) {