Need help with Regexp in file types dialog

English support forum

Moderators: Hacker, petermad, Stefan2, white

User avatar
Ovg
Power Member
Power Member
Posts: 755
Joined: 2014-01-06, 16:26 UTC

Need help with Regexp in file types dialog

Post by *Ovg »

"Specify file type, e.g. *.txt, or RegEx with leading '<', like <(a|b)"

I try to write Regex for file type consist of e.g. *.xls and *.doc, but no luck.

Could somebody help me?


PS I'm sorry for my ugly English ...
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
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

And what is the question?

To operate on two file types, separate them by a semicolon ;

*.xls ;*.doc


No RegEx needed here, isn't it? Or what do you want to do?
User avatar
Ovg
Power Member
Power Member
Posts: 755
Joined: 2014-01-06, 16:26 UTC

Post by *Ovg »

2Stefan2

A want to understand how to use regexp here. This two types I gave for example. Could you to write example for me?

BTW Thank you for answer *.xls ;*.doc. I'll use it in suitable cases :-)
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
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Regular Expressions inside TotalCommander

Post by *Stefan2 »

Well, just take a RegEx Tutorial and then use RegEx, but we two TC specialties:

1) prefix the RegEx by an '<'
2) the use of leading and trailing '.*' seems not needed here.


E.g. in TC folder
- press NumPad "+" key

- enter '<\d' to select every file with at least one digit in it
\d is the regex here

- or enter '<tcm' to select those files
tcm is the regex here

- or '<dll|exe' to select *.DLL and *.Exe files
'dll | exe' is the regex here


Perhaps from more use:
<(32|64).exe
Will select every file like 'xxxx32.exe' and 'xxxx64.exe'
Again, the normally needed '.*' in front is not needed here in TC.
The normal expression outside of TC would be '.+(32|64).exe'


.
User avatar
Ovg
Power Member
Power Member
Posts: 755
Joined: 2014-01-06, 16:26 UTC

Post by *Ovg »

2Stefan2
Thank you for clear explanation! And this work fine in
E.g. in TC folder
- press NumPad "+" key
, but for me this didn't work in color filter dialog ..... e.g. or add custom columns dialog of overwrite file dialog

PS I have some experience with RegExp and it is strange to me no luck in this simple case ...
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
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

I never use this myself,... so I am out of help here, sorry.




 
User avatar
Aezay
Senior Member
Senior Member
Posts: 269
Joined: 2003-02-12, 07:27 UTC
Location: Denmark
Contact:

Post by *Aezay »

Ovg wrote:but for me this didn't work in color filter dialog
Just tested this myself and it didn't work either, but if you define a selection however, it does work. Seems like a minor bug perhaps?
Of all the planets I've been to, this one is my favorite.
User avatar
white
Power Member
Power Member
Posts: 6014
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

Stefan2 wrote:<(32|64).exe
Will select every file like 'xxxx32.exe' and 'xxxx64.exe'
Again, the normally needed '.*' in front is not needed here in TC.
The normal expression outside of TC would be '.+(32|64).exe'
Correction:
<(32|64).exe
Will select every file like 'xxxx32xexexxxx' and 'xxxx64xexexxxx'
You don't have to specify a pattern for the text before 32 or 64 because that is how regular expression matching works in any program. Regular expression matching tries to match the pattern anywhere in a string.
The expression to match the entire file name would be '^.+(32|64)\.exe$' (the ^ symbol can be left out in this case because it results to the same thing).
Ovg wrote:2Stefan2
Thank you for clear explanation! And this work fine in
E.g. in TC folder
- press NumPad "+" key
, but for me this didn't work in color filter dialog ..... e.g. or add custom columns dialog of overwrite file dialog
Because it does not work in those dialogs. You will have to use the define button there.

The following was added to TC8.50:
HISTORY.TXT wrote:26.02.13 Added: Show example in dialog "expand selection" (key "+" on numeric keypad) how to enter regular expressions directly (32/64)
The dialog is reused in situations where you cannot use regular expressions directly. So I would call this a bug.
User avatar
Ovg
Power Member
Power Member
Posts: 755
Joined: 2014-01-06, 16:26 UTC

Post by *Ovg »

minor bug
Ok, I guess so, but at first i wanted ask GURU :-)
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
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

white wrote:
Stefan2 wrote:<(32|64).exe
Will select every file like 'xxxx32.exe' and 'xxxx64.exe'
Again, the normally needed '.*' in front is not needed here in TC.
The normal expression outside of TC would be '.+(32|64).exe'
Correction:
<(32|64).exe
Will select every file like 'xxxx32xexexxxx' and 'xxxx64xexexxxx'
Right of course. I just don't want to make it too complicated.

white wrote: You don't have to specify a pattern for the text before 32 or 64 because
that is how regular expression matching works in any program.
Regular expression matching tries to match the pattern anywhere in a string.
Huh? :o
Not in every program. It always depends how the regex engine is implemented.


.
User avatar
Ovg
Power Member
Power Member
Posts: 755
Joined: 2014-01-06, 16:26 UTC

Post by *Ovg »

2white

If I right understood, in those (add custom columns, set color) dialogs regexp doesn't works and it isn't a bug? Right?
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
white
Power Member
Power Member
Posts: 6014
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

Ovg wrote:2white

If I right understood, in those (add custom columns, set color) dialogs regexp doesn't works and it isn't a bug? Right?
Seems to be. The bug is either in the caption text or the bug is that regexp is not working in those dialogs. It's up to Mr. Ghisler to clarify this.
User avatar
Ovg
Power Member
Power Member
Posts: 755
Joined: 2014-01-06, 16:26 UTC

Post by *Ovg »

Ok. Thanks to All for answers!
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
solid
Power Member
Power Member
Posts: 755
Joined: 2004-08-09, 11:20 UTC

Post by *solid »

In what set color dialog regex doesn't work?
Seems quite ok in the 'define colors by filetipe'.
User avatar
Ovg
Power Member
Power Member
Posts: 755
Joined: 2014-01-06, 16:26 UTC

Post by *Ovg »

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
Post Reply