mirror of
https://github.com/MidnightCommander/mc
synced 2025-02-03 17:07:00 +03:00
Implement case insensitive for regex keyword.
regex/i is used now for case-insensitive regular expressions. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
97cd63b9fd
commit
cbcae18836
105
misc/mc.ext.in
105
misc/mc.ext.in
@ -17,6 +17,9 @@
|
||||
# \| matches the literal | and | has special meaning (or) and
|
||||
# () have special meaning and \( \) stand for literal ( ).
|
||||
#
|
||||
# regex/i (desc is an extended regular expression)
|
||||
# The same as regex but with case insensitive.
|
||||
#
|
||||
# type (file matches this if `file %f` matches regular expression desc
|
||||
# (the filename: part from `file %f` is removed))
|
||||
#
|
||||
@ -137,12 +140,12 @@ regex/\.tar\.F$
|
||||
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view tar.F
|
||||
|
||||
# .qpr/.qpk - QNX Neutrino package installer files
|
||||
regex/\.(qp[rk])$
|
||||
regex/\.qp[rk]$
|
||||
Open=%cd %p/utar://
|
||||
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view tar.qpr
|
||||
|
||||
# tar
|
||||
regex/\.(tar|TAR)$
|
||||
regex/i/\.tar$
|
||||
Open=%cd %p/utar://
|
||||
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view tar
|
||||
|
||||
@ -152,27 +155,27 @@ type/^LHa\ .*archive
|
||||
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view lha
|
||||
|
||||
# arj
|
||||
regex/\.a(rj|[0-9][0-9])$
|
||||
regex/i/\.a(rj|[0-9][0-9])$
|
||||
Open=%cd %p/uarj://
|
||||
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view arj
|
||||
|
||||
# cab
|
||||
regex/\.([cC][aA][bB])$
|
||||
regex/i/\.cab$
|
||||
Open=%cd %p/ucab://
|
||||
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view cab
|
||||
|
||||
# ha
|
||||
regex/\.([Hh][Aa])$
|
||||
regex/i/\.ha$
|
||||
Open=%cd %p/uha://
|
||||
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view ha
|
||||
|
||||
# rar
|
||||
regex/\.[rR]([aA][rR]|[0-9][0-9])$
|
||||
regex/i/\.r(ar|[0-9][0-9])$
|
||||
Open=%cd %p/urar://
|
||||
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view rar
|
||||
|
||||
# ALZip
|
||||
regex/\.(alz|ALZ)$
|
||||
regex/i/\.alz$
|
||||
Open=%cd %p/ualz://
|
||||
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view alz
|
||||
|
||||
@ -194,7 +197,7 @@ shell/.cpio
|
||||
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view cpio
|
||||
|
||||
# 7zip archives (they are not man pages)
|
||||
regex/\.(7z|7Z)$
|
||||
regex/i/\.7z$
|
||||
Open=%cd %p/u7z://
|
||||
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view 7z
|
||||
|
||||
@ -241,7 +244,7 @@ shell/.deba
|
||||
View=%view{ascii} @EXTHELPERSDIR@/package.sh view deba
|
||||
|
||||
# ISO9660
|
||||
regex/\.([iI][sS][oO])$
|
||||
regex/i/\.iso$
|
||||
Open=%cd %p/iso9660://
|
||||
View=%view{ascii} @EXTHELPERSDIR@/misc.sh view iso9660
|
||||
|
||||
@ -257,7 +260,7 @@ regex/\.s?a$
|
||||
View=%view{ascii} @EXTHELPERSDIR@/misc.sh view ar
|
||||
|
||||
# gplib
|
||||
regex/\.([Ll][Ii][Bb])$
|
||||
regex/i/\.lib$
|
||||
Open=%cd %p/ulib://
|
||||
View=%view{ascii} @EXTHELPERSDIR@/misc.sh view lib
|
||||
|
||||
@ -314,7 +317,7 @@ shell/.info
|
||||
Open=@EXTHELPERSDIR@/text.sh open info
|
||||
|
||||
# Exception: .3gp are video files not manual pages
|
||||
regex/\.(3[gG][pP])$
|
||||
regex/i/\.3gp$
|
||||
Include=video
|
||||
|
||||
# Manual page
|
||||
@ -364,7 +367,7 @@ regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.xz$
|
||||
View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view man.xz %var{PAGER:more}
|
||||
|
||||
# CHM
|
||||
regex/\.(chm|CHM)$
|
||||
regex/i/\.chm$
|
||||
Open=@EXTHELPERSDIR@/text.sh open chm
|
||||
|
||||
### Images ###
|
||||
@ -417,84 +420,84 @@ include/image
|
||||
|
||||
### Sound files ###
|
||||
|
||||
regex/\.([wW][aA][vV]|[sS][nN][dD]|[vV][oO][cC]|[aA][uU]|[sS][mM][pP]|[aA][iI][fF][fF]|[sS][nN][dD])$
|
||||
regex/i/\.(wav|snd|voc|au|smp|aiff|snd)$
|
||||
Open=@EXTHELPERSDIR@/sound.sh open common
|
||||
|
||||
regex/\.([mM][oO][dD]|[sS]3[mM]|[xX][mM]|[iI][tT]|[mM][tT][mM]|669|[sS][tT][mM]|[uU][lL][tT]|[fF][aA][rR])$
|
||||
regex/i/\.(mod|s3m|xm|it|mtm|669|stm|ult|far)$
|
||||
Open=@EXTHELPERSDIR@/sound.sh open mod
|
||||
|
||||
regex/\.([wW][aA][wW]22)$
|
||||
regex/i/\.waw22$
|
||||
Open=@EXTHELPERSDIR@/sound.sh open wav22
|
||||
|
||||
regex/\.([mM][pP]3)$
|
||||
regex/i/\.mp3$
|
||||
Open=@EXTHELPERSDIR@/sound.sh open mp3
|
||||
View=%view{ascii} @EXTHELPERSDIR@/sound.sh view mp3
|
||||
|
||||
regex/\.([oO][gG][gG|aA|vV|xX])$
|
||||
regex/i/\.og[gavx]$
|
||||
Open=@EXTHELPERSDIR@/sound.sh open ogg
|
||||
View=%view{ascii} @EXTHELPERSDIR@/sound.sh view ogg
|
||||
|
||||
regex/\.([sS][pP][xX]|[fF][lL][aA][cC])$
|
||||
regex/i/\.(spx|flac)$
|
||||
Open=@EXTHELPERSDIR@/sound.sh open common
|
||||
|
||||
regex/\.([mM][iI][dD][iI]?|[rR][mM][iI][dD]?)$
|
||||
regex/i/\.(midi?|rmid?)$
|
||||
Open=@EXTHELPERSDIR@/sound.sh open midi
|
||||
|
||||
regex/\.([wW][mM][aA])$
|
||||
regex/i/\.wma$
|
||||
Open=@EXTHELPERSDIR@/sound.sh open wma
|
||||
View=%view{ascii} @EXTHELPERSDIR@/sound.sh view wma
|
||||
|
||||
|
||||
### Play lists ###
|
||||
|
||||
regex/\.([mM]3[uU]|[pP][lL][sS])$
|
||||
regex/i/\.(m3u|pls)$
|
||||
Open=@EXTHELPERSDIR@/sound.sh open playlist
|
||||
|
||||
|
||||
### Video ###
|
||||
|
||||
regex/\.([aA][vV][iI])$
|
||||
regex/i/\.avi$
|
||||
Include=video
|
||||
|
||||
regex/\.([aA][sS][fFxX])$
|
||||
regex/i/\.as[fx]$
|
||||
Include=video
|
||||
|
||||
regex/\.([dD][iI][vV][xX])$
|
||||
regex/i/\.divx$
|
||||
Include=video
|
||||
|
||||
regex/\.([mM][kK][vV])$
|
||||
regex/i/\.mkv$
|
||||
Include=video
|
||||
|
||||
regex/\.([mM][oO][vV]|[qQ][tT])$
|
||||
regex/i/\.(mov|qt)$
|
||||
Include=video
|
||||
|
||||
regex/\.([mM][pP]4|[mM]4[vV]|[mM][pP][eE]?[gG])$
|
||||
regex/i/\.(mp4|m4v|mpe?g)$
|
||||
Include=video
|
||||
|
||||
# MPEG-2 TS container + H.264 codec
|
||||
regex/\.([mM][tT][sS])$
|
||||
regex/i/\.mts$
|
||||
Include=video
|
||||
|
||||
regex/\.([tT][sS])$
|
||||
regex/i/\.ts$
|
||||
Include=video
|
||||
|
||||
regex/\.([vV][oO][bB])$
|
||||
regex/i/\.vob$
|
||||
Include=video
|
||||
|
||||
regex/\.([wW][mM][vV])$
|
||||
regex/i/\.wmv$
|
||||
Include=video
|
||||
|
||||
regex/\.([fF][lL][iIcCvV])$
|
||||
regex/i/\.fl[icv]$
|
||||
Include=video
|
||||
|
||||
regex/\.([oO][gG][mM])$
|
||||
regex/i/\.ogm$
|
||||
Include=video
|
||||
|
||||
regex/\.([rR][aA]?[mM])$
|
||||
regex/i/\.ra?m$
|
||||
Open=@EXTHELPERSDIR@/video.sh open ram
|
||||
|
||||
# WebM
|
||||
regex/\.([wW][eE][bB][mM])$
|
||||
regex/i/\.webm$
|
||||
Include=video
|
||||
|
||||
type/WebM
|
||||
@ -518,7 +521,7 @@ type/^PDF
|
||||
View=%view{ascii} @EXTHELPERSDIR@/doc.sh view pdf
|
||||
|
||||
# html
|
||||
regex/\.([hH][tT][mM][lL]?)$
|
||||
regex/i/\.html?$
|
||||
Open=@EXTHELPERSDIR@/web.sh open html
|
||||
View=%view{ascii} @EXTHELPERSDIR@/web.sh view html
|
||||
|
||||
@ -527,7 +530,7 @@ shell/.sdw
|
||||
Open=@EXTHELPERSDIR@/doc.sh open ooffice
|
||||
|
||||
# StarOffice 6 and OpenOffice.org formats
|
||||
regex/\.(odt|ott|sxw|stw|ods|ots|sxc|stc|odp|otp|sxi|sti|odg|otg|sxd|std|odb|odf|sxm|odm|sxg)$
|
||||
regex/i/\.(odt|ott|sxw|stw|ods|ots|sxc|stc|odp|otp|sxi|sti|odg|otg|sxd|std|odb|odf|sxm|odm|sxg)$
|
||||
Open=@EXTHELPERSDIR@/doc.sh open ooffice
|
||||
View=%view{ascii} @EXTHELPERSDIR@/doc.sh view odt
|
||||
|
||||
@ -536,7 +539,7 @@ shell/.abw
|
||||
Open=@EXTHELPERSDIR@/doc.sh open abw
|
||||
|
||||
# Microsoft Word Document
|
||||
regex/\.([Dd][oO][cCtT]|[Ww][rR][iI])$
|
||||
regex/i/\.(do[ct]|wri)$
|
||||
Open=@EXTHELPERSDIR@/doc.sh open msdoc
|
||||
View=%view{ascii} @EXTHELPERSDIR@/doc.sh view msdoc
|
||||
type/^Microsoft\ Word
|
||||
@ -544,11 +547,11 @@ type/^Microsoft\ Word
|
||||
View=%view{ascii} @EXTHELPERSDIR@/doc.sh view msdoc
|
||||
|
||||
# RTF document
|
||||
regex/\.([rR][tT][fF])$
|
||||
regex/i/\.rtf$
|
||||
Open=@EXTHELPERSDIR@/doc.sh open msdoc
|
||||
|
||||
# Microsoft Excel Worksheet
|
||||
regex/\.([xX][lL][sSwW])$
|
||||
regex/i/\.xl[sw]$
|
||||
Open=@EXTHELPERSDIR@/doc.sh open msxls
|
||||
View=%view{ascii} @EXTHELPERSDIR@/doc.sh view msxls
|
||||
type/^Microsoft\ Excel
|
||||
@ -564,16 +567,16 @@ type/^FrameMaker
|
||||
Open=@EXTHELPERSDIR@/doc.sh open framemaker
|
||||
|
||||
# DVI
|
||||
regex/\.([dD][vV][iI])$
|
||||
regex/i/\.dvi$
|
||||
Open=@EXTHELPERSDIR@/doc.sh open dvi
|
||||
View=%view{ascii} @EXTHELPERSDIR@/doc.sh view dvi
|
||||
|
||||
# TeX
|
||||
regex/\.([Tt][Ee][Xx])$
|
||||
regex/i/\.tex$
|
||||
Include=editor
|
||||
|
||||
# DjVu
|
||||
regex/\.(djvu?|DJVU?)$
|
||||
regex/i/\.djvu?$
|
||||
Open=@EXTHELPERSDIR@/doc.sh open djvu
|
||||
View=%view{ascii} @EXTHELPERSDIR@/doc.sh view djvu
|
||||
|
||||
@ -592,7 +595,7 @@ regex/^Makefile.(PL|pl)$
|
||||
Open=%var{PERL:perl} %f
|
||||
|
||||
# dbf
|
||||
regex/\.([dD][bB][fF])$
|
||||
regex/i/\.dbf$
|
||||
Open=%view{ascii} @EXTHELPERSDIR@/misc.sh open dbf
|
||||
View=%view{ascii} @EXTHELPERSDIR@/misc.sh view dbf
|
||||
|
||||
@ -601,13 +604,13 @@ regex/\.(rexx?|cmd)$
|
||||
Open=rexx %f %{Enter parameters};echo "Press ENTER";read y
|
||||
|
||||
# Disk images for Commodore computers (VIC20, C64, C128)
|
||||
regex/\.(d64|D64)$
|
||||
regex/i/\.d64$
|
||||
Open=%cd %p/uc1541://
|
||||
View=%view{ascii} c1541 %f -list
|
||||
Extract=c1541 %f -extract
|
||||
|
||||
# Glade, a user interface designer for GTK+ and GNOME
|
||||
regex/\.([Gg][Ll][Aa][Dd][Ee])$
|
||||
regex/i/\.glade$
|
||||
Open=@EXTHELPERSDIR@/misc.sh open glade
|
||||
|
||||
# Gettext Catalogs
|
||||
@ -615,24 +618,24 @@ shell/.mo
|
||||
View=%view{ascii} @EXTHELPERSDIR@/misc.sh view mo
|
||||
|
||||
# lyx
|
||||
regex/\.(lyx|LYX)$
|
||||
regex/i/\.lyx$
|
||||
Open=@EXTHELPERSDIR@/misc.sh open lyx
|
||||
View=%view{ascii} @EXTHELPERSDIR@/misc.sh view lyx
|
||||
|
||||
# torrent
|
||||
regex/\.([tT][oO][rR][rR][eE][nN][tT])$
|
||||
regex/i/\.torrent$
|
||||
View=%view{ascii} @EXTHELPERSDIR@/misc.sh view torrent
|
||||
|
||||
### Plain compressed files ###
|
||||
|
||||
# ace
|
||||
regex/\.(ace|ACE)$
|
||||
regex/i/\.ace$
|
||||
Open=%cd %p/uace://
|
||||
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view ace
|
||||
Extract=unace x %f
|
||||
|
||||
# arc
|
||||
regex/\.(arc|ARC)$
|
||||
regex/i/\.arc$
|
||||
Open=%cd %p/uarc://
|
||||
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view arc
|
||||
Extract=arc x %f '*'
|
||||
@ -644,7 +647,7 @@ type/^([Zz][Ii][Pp])\ archive
|
||||
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view zip
|
||||
|
||||
# zoo
|
||||
regex/\.([Zz][Oo][Oo])$
|
||||
regex/i/\.zoo$
|
||||
Open=%cd %p/uzoo://
|
||||
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view zoo
|
||||
|
||||
|
@ -856,12 +856,22 @@ regex_command (const vfs_path_t * filename_vpath, const char *action)
|
||||
}
|
||||
else if (strncmp (p, "regex/", 6) == 0)
|
||||
{
|
||||
gboolean case_insense;
|
||||
mc_search_t *search;
|
||||
|
||||
p += 6;
|
||||
/* Do not transform shell patterns, you can use shell/ for
|
||||
* that
|
||||
*/
|
||||
if (mc_search (p, filename, MC_SEARCH_T_REGEX))
|
||||
found = TRUE;
|
||||
case_insense = (strncmp (p, "i/", 2) == 0);
|
||||
if (case_insense)
|
||||
p += 2;
|
||||
|
||||
search = mc_search_new (p, -1);
|
||||
if (search != NULL)
|
||||
{
|
||||
search->search_type = MC_SEARCH_T_REGEX;
|
||||
search->is_case_sensitive = !case_insense;
|
||||
found = mc_search_run (search, filename, 0, file_len, NULL);
|
||||
mc_search_free (search);
|
||||
}
|
||||
}
|
||||
else if (strncmp (p, "directory/", 10) == 0)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user