filenames search with more specific inquire (full words)

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
abc550
Posts: 38
Joined: 18 Feb 2010 09:46

filenames search with more specific inquire (full words)

Post by abc550 »

Is there any option to find (in any search mode) all files, which includes some full words?

E.g search inquire cow*girl* in standard search mode currently returns:
cow eats my girl.doc
and
cowS eat my girlfriend.txt
and
cowgirls songs.mp3

Is it possible to exclude all variants except the first one?

Thanks!

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: filenames search with more specific inquire (full words)

Post by TheQwerty »

Doesn't a standard search for "cow girl" with match Whole Words enabled achieve this?

abc550
Posts: 38
Joined: 18 Feb 2010 09:46

Re: filenames search with more specific inquire (full words)

Post by abc550 »

TheQwerty wrote:Doesn't a standard search for "cow girl" with match Whole Words enabled achieve this?
It's not quite the same: standard search mode without wildcards disregards the order of the elements of a serch inquire. So the inquie "cow girl" with match Whole Words enabled will return e.g. girl eats a cow. But the order is important: I need to find only items which start with the word "cow".

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

Re: filenames search with more specific inquire (full words)

Post by admin »

Some RegExp will do... let's hear what the experts have to say...

highend
Posts: 14955
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: filenames search with more specific inquire (full words)

Post by highend »

A standard regex for this could look like:

\bcow\b.*\bgirl\b
One of my scripts helped you out? Please donate via Paypal

abc550
Posts: 38
Joined: 18 Feb 2010 09:46

Re: filenames search with more specific inquire (full words)

Post by abc550 »

highend wrote:A standard regex for this could look like:
\bcow\b.*\bgirl\b
Seems, that is just the same as the sample "cow girl" with match Whole Words enabled in standard mode (see previous posts in this topic). The both ignore the sequence of the words. This sample will find the both "cow eats a girl.txt" and "a girl eats a cow.txt".
Furthermore, it would be nice to have an option to find only those items, where the first word of the search query does match with the first word of the filename.

highend
Posts: 14955
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: filenames search with more specific inquire (full words)

Post by highend »

Before I posted that regex I tried it...

These are the files in my testfolder:

Code: Select all

a cow eats a girl.txt
a girl eats a cow.txt
cow eats a girl.txt
cowgirls songs.mp3
cowS eat my girlfriend.txt
Regex:

Code: Select all

\bcow\b.*\bgirl\b
Finds 2 files:

Code: Select all

a cow eats a girl.txt
cow eats a girl.txt
"a girl eats a cow.txt" is NOT found...

And if you want to find these two words with cow at the beginning of the line use:

Code: Select all

^\bcow\b.*\bgirl\b
Used for the same 5 files, it will only find:

Code: Select all

cow eats a girl.txt
Afaik that's what you wanted...
One of my scripts helped you out? Please donate via Paypal

abc550
Posts: 38
Joined: 18 Feb 2010 09:46

Re: filenames search with more specific inquire (full words)

Post by abc550 »

highend wrote:Before I posted that regex I tried it...
Afaik that's what you wanted...
My apologies! I've tested your regexp with a wrong files set. Actually the both your regexps work exactly as I needed.
Many thanks!

Post Reply