RegEx in file type definition window

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
wanderer
Power Member
Power Member
Posts: 1644
Joined: 2003-03-28, 14:35 UTC
Location: Sol

RegEx in file type definition window

Post by *wanderer »

I'd like to define a color by file type but enter multiple types for the same color. Instead for defining multiple entries with the same color for different file types, i instead tried (unsuccessfully) to use regex. Specifically the following two combinations:

Code: Select all

*.xls<(x|m)
<(*.xlsx|*.xlsm)
Can someone please point me to the right direction? TIA.

P.S.: Help isn't much... helpful! :)
- Wanderer -

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3 (very rarely nowadays).
x64: Clients/Servers - Win10/Win11 and Win2K16 to Win2K22, mainly Win10 though.
User avatar
wanderer
Power Member
Power Member
Posts: 1644
Joined: 2003-03-28, 14:35 UTC
Location: Sol

Post by *wanderer »

Yeah, well, i don't know why i bothered with regex. A simple "*.xlsx *.xlsm" string did the job. I however would like to know how would this be done with regex. Haven't played much with regex, so some pointers would be great.
- Wanderer -

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3 (very rarely nowadays).
x64: Clients/Servers - Win10/Win11 and Win2K16 to Win2K22, mainly Win10 though.
User avatar
tuska
Power Member
Power Member
Posts: 4118
Joined: 2007-05-21, 12:17 UTC

Post by *tuska »

I tried the online RegEx tester because I have no RegEx knowledge.

https://regex101.com/
TEST STRING:                *.xlsx *.xlsm
REGULAR EXPRESSION:      "*.xlsx|"*.xlsm --> In TC: Everything must not be ticked!

TC-Search...-Alt+F7:         "*.xlsx|"*.xlsm --> with RegEx ticked, Everything unticked -> finds: *.xlsx *.xlsm

EDIT: Please consider the following as irrelevant - solution is below... viewtopic.php?p=337596#337596
-------------------------------------
Configuration - Options - Color - Define colors by file type... >"*.xlsx|"*.xlsm, Define: Search for: "*.xlsx|"*.xlsm
RegEx ticked, Everything unticked -> Save: "*.xlsx|"*.xlsm -> OK -> choose color -> OK -> >"*.xlsx|"*.xlsm (is displayed in blue)
OK, OK

Results:
- Excel files (* .xlsx * .xlsm) do not appear in color blue
- With RegEx I did not manage to color the files (but maybe the RegEx expression would have to be different?)
-------------------------------------
EDIT:\END
Last edited by tuska on 2018-02-03, 20:58 UTC, edited 3 times in total.
User avatar
wanderer
Power Member
Power Member
Posts: 1644
Joined: 2003-03-28, 14:35 UTC
Location: Sol

Post by *wanderer »

Thanks for the examples. I'll try it out.
- Wanderer -

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3 (very rarely nowadays).
x64: Clients/Servers - Win10/Win11 and Win2K16 to Win2K22, mainly Win10 though.
User avatar
Ovg
Power Member
Power Member
Posts: 755
Joined: 2014-01-06, 16:26 UTC

Post by *Ovg »

2wanderer

<.*\.xls(x|m)

. - any symbol
* - 0 to infinity times
\. - literal dot
xls - literal xls
(x|m) - literal x or m
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
User avatar
wanderer
Power Member
Power Member
Posts: 1644
Joined: 2003-03-28, 14:35 UTC
Location: Sol

Post by *wanderer »

2 Ovg

Well, this seems closer to what i was trying and closer to the directions inside TC's "Color by file type" window. I'll try this too. Thanks.
- Wanderer -

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3 (very rarely nowadays).
x64: Clients/Servers - Win10/Win11 and Win2K16 to Win2K22, mainly Win10 though.
User avatar
tuska
Power Member
Power Member
Posts: 4118
Joined: 2007-05-21, 12:17 UTC

RegEx - define color for *.xlsx *.xlsm

Post by *tuska »

Solution:

Configuration - Options - Color - Define colors by file type... -> Add: <"*.xlsx|"*.xlsm, OK, choose color [blue] -> OK
<"*.xlsx|"*.xlsm (is displayed in blue) - OK (in the background you can already see *.xlsx and *.xlsm in color blue) - OK - FINISHED!

But you can certainly use the RegEx expression of Ovg.

I thought a bit too complicated before :roll:

******************
To my question (by email):
"If I colorize files/folders that contain the word "done", then this is easily possible, but without saving the hook in "Everything"."
I received the following answer on 30.1.2018
ghisler(Author) wrote:'Everything' is not supported for colors by file type.
Reason: Total Commander does not search, he just compares the foldernames or their attributes with the specified search options.
That means also that Search for: ed:regex:"*.xlsx|"*.xlsm ... Everything ticked, RegEx in TC unticked is not possible in this context.
(The check mark for "Everything" is automatically deleted).
Post Reply