QuickSearch eXtended

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
oshizelly
Junior Member
Junior Member
Posts: 60
Joined: 2013-09-07, 13:51 UTC

Post by *oshizelly »

2Peter
n the manual there is a small chapter about "Reg Ex - Regular Expressions".
I have some very basic knowledges and experiences with using regular expressions, far from being an expert in this question.

However this basic information makes me to strongly doubt, that regular expressions might be the proper tool to compose search queries with logical operators, including negator conditions. Are you sure, that it is possible?
User avatar
Peter
Power Member
Power Member
Posts: 2064
Joined: 2003-11-13, 13:40 UTC
Location: Schweiz

Post by *Peter »

I think it should do the job. Take a look at the Help for TotalCommander, there is a basic description and links of RegEx. Here in the forum are many RegEx discussions too. Try it :wink:

Peter
TC 10.xx / #266191
Win 10 x64
oshizelly
Junior Member
Junior Member
Posts: 60
Joined: 2013-09-07, 13:51 UTC

Post by *oshizelly »

2Peter
I think it should do the job.
Could you please bring a sample for any of my four search queries, what way it might be solved via regular expressions?

Thanks!
User avatar
white
Power Member
Power Member
Posts: 4633
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

oshizelly wrote:Could anybody help to compose the query to find:

1) filenames, which include the words [cat], but not [dog].
I haven't installed QuickSearch eXtended. But try:

Code: Select all

?^(?!.*dog).*cat
User avatar
Samuel
Power Member
Power Member
Posts: 1930
Joined: 2003-08-29, 15:44 UTC
Location: Germany, Brandenburg an der Havel
Contact:

Post by *Samuel »

white wrote:
oshizelly wrote:Could anybody help to compose the query to find:

1) filenames, which include the words [cat], but not [dog].
I haven't installed QuickSearch eXtended. But try:

Code: Select all

?^(?!.*dog).*cat
I can confirm that this answer works in QSx. Thanks white and Peter for pointing towards RegEx.

However QSx was designed to work quick and on the fly. For advanced searches you may prefer TCs own search. See "plugin" page there. You may create rules like that there without having to know about RegEx.
oshizelly
Junior Member
Junior Member
Posts: 60
Joined: 2013-09-07, 13:51 UTC

Post by *oshizelly »

2Samuel
However QSx was designed to work quick and on the fly. For advanced searches you may prefer TCs own search
Well, actually my samples of search expressions were not very advanced/complex, at least the first of them: filenames, which include the words [cat], but not [dog].
The only specific aspect of it, that it uses a negative condition instead of the similar positive ("dog or cat" or "dog and cat").

It's very pity, that QuickSearch eXtended does not support this type of search queries :( Could you please consider adding this functionality in future?
For advanced searches you may prefer TCs own search. See "plugin" page there. You may create rules like that there without having to know about RegEx.
I'm aware of this and use it much... but it is a solution for quite different cases. This is simply another functionality, which is not proper for quick filtering inside a file pane, even if you use the button [Feed to listbox] in order to send your search results to a file pane.


2white

Code: Select all

?^(?!.*dog).*cat
Thank you for your regexp sample, it works. :D
But when we use this type of syntax in QuickSearch eXtended, iwe need to remember, that this expression will NOT work if the option [Match only at beginning of files/words] is disabled (what is default value, if I remember correctly, anyway I have it always disabled).

I haven't installed QuickSearch eXtended.
I'd recommend you to correct this mistake ;)
This splendid plugin in really "must have", whatever thing you do not with Total Commander. Well, I can't promise, that it will change your life ;), but it surely change your concept of what you can do with quick filter in the file pane.
User avatar
Samuel
Power Member
Power Member
Posts: 1930
Joined: 2003-08-29, 15:44 UTC
Location: Germany, Brandenburg an der Havel
Contact:

Post by *Samuel »

oshizelly wrote:2Samuel
However QSx was designed to work quick and on the fly. For advanced searches you may prefer TCs own search
Well, actually my samples of search expressions were not very advanced/complex, at least the first of them: filenames, which include the words [cat], but not [dog].
The only specific aspect of it, that it uses a negative condition instead of the similar positive ("dog or cat" or "dog and cat").

It's very pity, that QuickSearch eXtended does not support this type of search queries :( Could you please consider adding this functionality in future?
I consider it.

I mainly (>80%) use it to search for searches like "cat .txt" to find every textfile containing "cat".
User avatar
white
Power Member
Power Member
Posts: 4633
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

oshizelly wrote: 2white

Code: Select all

?^(?!.*dog).*cat
Thank you for your regexp sample, it works. :D
But when we use this type of syntax in QuickSearch eXtended, iwe need to remember, that this expression will NOT work if the option [Match only at beginning of files/words] is disabled (what is default value, if I remember correctly, anyway I have it always disabled).
That option doesn't make any sense when using regular expressions which is partial matching by nature. So I would call this a bug. Regex matching should always be performed on the entire string and the option mentioned above shouldn't influence it.
oshizelly
Junior Member
Junior Member
Posts: 60
Joined: 2013-09-07, 13:51 UTC

Post by *oshizelly »

2Samuel
I mainly (>80%) use it to search for searches like "cat .txt" to find every textfile containing "cat".
Yes, I see. However the needs of different users might be different.
I use your fine plugin a lot in order to filter my work documents, so negative condition is highly needed (say, in order to show all various documents regarding Mr. Smith, but excepting invoices).

I admit, that my samples 2, 3 and 4 are a bit more specific and might mot be needed every day, but sample search query nr 1 ([cat], but not [dog]) surely covers the very basic needs for regular day-to-day usage.

2white
That option doesn't make any sense when using regular expressions which is partial matching by nature
May be, I can't comment it any way. The only thing I can state, is the fact, that at my TC this regular expression you have composed works only when the option [Match only at beginning of files/words] is disabled. Well, you could test it yourself, may be I've done something wrong.
User avatar
white
Power Member
Power Member
Posts: 4633
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

oshizelly wrote:2white
That option doesn't make any sense when using regular expressions which is partial matching by nature
May be, I can't comment it any way. The only thing I can state, is the fact, that at my TC this regular expression you have composed works only when the option [Match only at beginning of files/words] is disabled. Well, you could test it yourself, may be I've done something wrong.
No, you haven't done anything wrong. The author of QuickSearch eXtended did something wrong. Apparently QuickSearch eXtended is searching for a regex match anywhere in a file name. Which is ridiculous because regex matching is searching by itself. QuickSearch eXtended should simply do a regex compare with the entire file name. The regex engine will search within the file name for the pattern. To illustrate this try the following.

Suppose you have the following files:
my_cat.txt
cat.txt

Set option [Match only at beginning of files/words] to Enabled.

This is what should happen (and probably does happen):

Use QuickSearch eXtended to search for "cat" finds:
cat.txt

Use QuickSearch eXtended to search for "?cat" finds:
my_cat.txt
cat.txt

Use QuickSearch eXtended to search for "?^cat" finds:
cat.txt

(not tested)
User avatar
Samuel
Power Member
Power Member
Posts: 1930
Joined: 2003-08-29, 15:44 UTC
Location: Germany, Brandenburg an der Havel
Contact:

Post by *Samuel »

Everything works like it was designed. I don't see any problems here.

Code: Select all

?^(?!.*dog).*cat
This does work with the option [Match only at beginning of files/words] enabled and disabled.

I think you tried some kind of the following expression, where it makes a difference.

Code: Select all

?(?!.*dog)cat
white wrote:That option doesn't make any sense when using regular expressions which is partial matching by nature.
I disagree - for consistency this works in all search modes including RegEx. All this option does for regex is adding a "^" in front of the expression (if it is not there) already. The expression "?cat" is converted to "?^cat". There is no effect with an expression like "?.*cat".

(everything was tested)
oshizelly
Junior Member
Junior Member
Posts: 60
Joined: 2013-09-07, 13:51 UTC

Post by *oshizelly »

2Samuel
This does work with the option [Match only at beginning of files/words] enabled and disabled.
At my TC exactly the same expression composed by white (only using other words instead of "cat" and "dog") returns nothing if the option [Match only at beginning of files/words] is disabled (my default mode), but returns several files when this option is enabled.

Well, I admit, that I could do something wrong myself. But please consider, that white confirms my report too: http://ghisler.ch/board/viewtopic.php?p=283935&sid=0b5464d7fd4439da01e618dcaaa9145d#283935 .
User avatar
Samuel
Power Member
Power Member
Posts: 1930
Joined: 2003-08-29, 15:44 UTC
Location: Germany, Brandenburg an der Havel
Contact:

Post by *Samuel »

Please post the content of your tcmatch.ini the exact used filtertext and the file you expect to get (that get wrongly filtered).

Have a look at white's post - he states that he didnt test at all.
I did check every example in the last few posts and everything worked as excepted.
User avatar
white
Power Member
Power Member
Posts: 4633
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

2oshizelly
I tested it now (using 32bit) and it works OK. So I now think you did something wrong.
Samuel wrote:
white wrote:That option doesn't make any sense when using regular expressions which is partial matching by nature.
I disagree - for consistency this works in all search modes including RegEx. All this option does for regex is adding a "^" in front of the expression (if it is not there) already. The expression "?cat" is converted to "?^cat". There is no effect with an expression like "?.*cat".
Yes, that solution is OK too. I tested it now and it seems you did a good job.

Sorry for the confusion.
User avatar
white
Power Member
Power Member
Posts: 4633
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

Samuel wrote:Everything works like it was designed. I don't see any problems here.

Code: Select all

?^(?!.*dog).*cat
This does work with the option [Match only at beginning of files/words] enabled and disabled.
It does not work when I select RegEx search in dropdown box and remove the leading question mark. How is that possible?
Post Reply