boolean search by the string in the beginning of the name

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Leopoldus
Posts: 237
Joined: 24 Jun 2004 10:58

boolean search by the string in the beginning of the name

Post by Leopoldus »

Hello!
I could not find any way to search filds and folders in Boolean mode (not in RegExp mode!) by the string in the beginning of the name. Is it possible?

Say we need to find all items with string "cat", which names:

1) begins from the string
(e.g. "Categories of dogs.doc", but not "Advocates list.htm" neither "Dogs surrounds a cat.jpg")

2) include any word beginning from the string
(eg. "Categories of dogs.doc" and "Dogs surrounds a cat.jpg", but not "Advocates list.htm")

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: boolean search by the string in the beginning of the nam

Post by admin »

1) cat*
2) cat* or * cat*

You meant this?

Leopoldus
Posts: 237
Joined: 24 Jun 2004 10:58

Post by Leopoldus »

1) cat*
2) cat* or * cat*
Thanks for the fine first expression, it works indeed (BTW this string may be in the any palce of of the search quary, not in the beginng only, i.e. cat* and dogs = dogs and cat*)

But regarding the second question I am not sure...
Cat* or *cat* = simply *cat*
isn'i it? So it will return every filename with the string "cat" at every position, so "Advocates list.htm" as well (in my example).

P.S.
Thanks for your fast reply and sorry for my delay with reaction, I was very busy last week cause of some troubles at my work.

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Post by jacky »

Leopoldus wrote:But regarding the second question I am not sure...
Cat* or *cat* = simply *cat*
isn'i it?
I think you missed a space there, it is * cat* as in *[space]cat* ! Hence why it would not match "Advocate" ;)
Proud XYplorer Fanatic

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Post by admin »

Leopoldus wrote:
1) cat*
2) cat* or * cat*
Thanks for the fine first expression, it works indeed (BTW this string may be in the any palce of of the search quary, not in the beginng only, i.e. cat* and dogs = dogs and cat*)

But regarding the second question I am not sure...
Cat* or *cat* = simply *cat*
isn'i it? So it will return every filename with the string "cat" at every position, so "Advocates list.htm" as well (in my example).
No, watch the blank between * and cat: cat* or * cat*

Leopoldus
Posts: 237
Joined: 24 Jun 2004 10:58

Post by Leopoldus »

I think you missed a space there, it is * cat* as in *[space]cat* ! Hence why it would not match "Advocate"
Thank you jacky and admin! You are right, I've not noticed this very essential difference :oops:
So it does really works, but... I don't understand, why it works. If symbol <*> means any word, so Boolean search inquire which includes a pattern "or *" should return every file at the location. But indeed it works in different way. :? Would you be so kind to explain, what does this syntax * cat* mean?

Linkaday
Posts: 364
Joined: 06 Aug 2007 14:40
Location: Hamburg, Germany - Win 10 Home v22H2 x64 1920x1080 (100%)

Post by Linkaday »

* cat*
actually is
[any or no char] up to [space]cat [any or no char]

matching "...and cat"
but neither "advocate" nor "cat" without a space before it :)

Leopoldus
Posts: 237
Joined: 24 Jun 2004 10:58

Post by Leopoldus »

Linkaday wrote:* cat*
actually is
[any or no char] up to [space]cat [any or no char]

matching "...and cat"
but neither "advocate" nor "cat" without a space before it :)
Thank you, I see.
But in this event it is not just exactly what I wished, that's why space is not the only possible words separator in file or folder name. As one can see, there are some other variants as well, so those words which have dots, comas, dashes, at-s etc. before them (e.g. "Dog versus 22_cats figth.jpg") will not be returned :(

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Post by admin »

Leopoldus wrote:
Linkaday wrote:* cat*
actually is
[any or no char] up to [space]cat [any or no char]

matching "...and cat"
but neither "advocate" nor "cat" without a space before it :)
Thank you, I see.
But in this event it is not just exactly what I wished, that's why space is not the only possible words separator in file or folder name. As one can see, there are some other variants as well, so those words which have dots, comas, dashes, at-s etc. before them (e.g. "Dog versus 22_cats figth.jpg") will not be returned :(
You could try this then: cat* or *[ ,.-_]cat*

Leopoldus
Posts: 237
Joined: 24 Jun 2004 10:58

Post by Leopoldus »

admin wrote:You could try this then: cat* or *[ ,.-_]cat*
It is OK, thanks :)
However there some other usual word separators as well, so the full expression should include them too, something like this:
cat* or *[ ,.-_ ;'´\!\(\&@#£$€¤%{[%=+~§“”«»1234567890]cat*
right?
Indeed it would be a bit more convenient to have some meta-character representing any possible words separator (this is any symbol except letter) - something similar to \W or \s in regular expressions, but not exactly.

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Post by admin »

Leopoldus wrote:
admin wrote:You could try this then: cat* or *[ ,.-_]cat*
It is OK, thanks :)
However there some other usual word separators as well, so the full expression should include them too, something like this:
cat* or *[ ,.-_ ;'\!\(\&@#£$€¤%{[%=+~§“”«»1234567890]cat*
right?
Indeed it would be a bit more convenient to have some meta-character representing any possible words separator (this is any symbol except letter) - something similar to \W or \s in regular expressions, but not exactly.
This should work [!A-Za-z] (or this? [!A-Z!a-z] ... no time to try now...)

Leopoldus
Posts: 237
Joined: 24 Jun 2004 10:58

Post by Leopoldus »

admin wrote:This should work [!A-Za-z] (or this? [!A-Z!a-z] ... no time to try now...)
Afraid that either of them does not work (returns nothing). I've tried to use <^> ("not" in regular expressions AFAIK) instead of <!>, it does not work too.
If and when you have a bit free time to play with it, may be you'll find the right construction. But for the practical needs one can use this clumsy syntax cat* or *[ ,.-_ ;'\!\(\&@#£$€¤%{[%=+~§“”«»1234567890]cat*.
Thank you again for help!
Last edited by Leopoldus on 08 Jun 2008 20:49, edited 1 time in total.

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Post by jacky »

admin wrote:This should work [!A-Za-z] (or this? [!A-Z!a-z] ... no time to try now...)
No I don't think that can work. The correct syntax would be [!a-z] but that's only supported in XY's Standard mode, not Boolean. I don't think there is such a thing in Booloean mode (as neither [!charlist] or [^charlist] seem to work)

And you can try something like :cat* or (*cat* and !*[a-z]cat*) but there's one huge flaw here, it would not match a file named "the category is advocate.txt" because of "advocate" !!

BTW Leopoldus, is there a reason you don't want to use regexp, maybe you could find one to do the work, something like >^cat.*$|[^a-z]cat
Proud XYplorer Fanatic

Leopoldus
Posts: 237
Joined: 24 Jun 2004 10:58

Post by Leopoldus »

jacky wrote:BTW Leopoldus, is there a reason you don't want to use regexp, maybe you could find one to do the work, something like >^cat.*$|[^a-z]cat
The reason is simple: my search inquire is realy longer then this fragment we are discussing here, it is indeed something like this:
:(cat* or * cat*) and dogs and food. Yes, it would be possible to use masks in regular expression mode as well as
>^cat.*$|[^a-z]cat.*dogs.*food, but the problem is the order of words: this regular expression will find (?) "Cats and dogs great food.txt", but not "Dogs and cats food.txt" neither "Food for cats, dogs and advocates.txt" ;)

BTW, what does mean symbol "$" in your example? AFAIK "$" is usually used in the meaning "Line end" in regular expressions syntax, but I suppose it has some other meaning in this case, right?

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Post by jacky »

No the $ does mean end of line, even here, though I'm actually not sure it was required here, but I know it doesn't hurt ;) That regexp basically meant (start of line)cat(anything)(end of line)(OR)(not a letter)(cat)

As for what you're trying to do, if it is only a list of words that must all be present in the filenames, then maybe this would work for you :

Code: Select all

>^(?=.*?\bdog\b)(?=.*?\bfood\b)(?=.*?\bcat).*$
This regexp sould match all filenames that contains the words "dog" and "food" and "cat*" (so cat, cats or category but not advocate)
Proud XYplorer Fanatic

Post Reply