boolean search by the string in the beginning of the name
boolean search by the string in the beginning of the name
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")
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")
-
- 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
1) cat*
2) cat* or * cat*
You meant this?
2) cat* or * cat*
You meant this?
FAQ | XY News RSS | XY Twitter
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*)1) cat*
2) cat* or * 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.
-
- Site Admin
- Posts: 60357
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @100%
- Contact:
No, watch the blank between * and cat: cat* or * cat*Leopoldus wrote: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*)1) cat*
2) cat* or * 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).
FAQ | XY News RSS | XY Twitter
Thank you jacky and admin! You are right, I've not noticed this very essential differenceI think you missed a space there, it is * cat* as in *[space]cat* ! Hence why it would not match "Advocate"
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?
Thank you, I see.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
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
-
- Site Admin
- Posts: 60357
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @100%
- Contact:
You could try this then: cat* or *[ ,.-_]cat*Leopoldus wrote:Thank you, I see.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
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
FAQ | XY News RSS | XY Twitter
It is OK, thanksadmin wrote:You could try this then: cat* or *[ ,.-_]cat*
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.
-
- Site Admin
- Posts: 60357
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @100%
- Contact:
This should work [!A-Za-z] (or this? [!A-Z!a-z] ... no time to try now...)Leopoldus wrote:It is OK, thanksadmin wrote:You could try this then: cat* or *[ ,.-_]cat*
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.
FAQ | XY News RSS | XY Twitter
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.admin wrote:This should work [!A-Za-z] (or this? [!A-Z!a-z] ... no time to try now...)
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.
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)admin wrote:This should work [!A-Za-z] (or this? [!A-Z!a-z] ... no time to try now...)
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
The reason is simple: my search inquire is realy longer then this fragment we are discussing here, it is indeed something like this: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
:(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?
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 :
This regexp sould match all filenames that contains the words "dog" and "food" and "cat*" (so cat, cats or category but not advocate)
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).*$
Proud XYplorer Fanatic