Search for whole words in file and folder names

Discussion & Support for xplorer² professional

Moderators: fgagnon, nikos, Site Mods

richardk
Silver Member
Silver Member
Posts: 188
Joined: 2007 Mar 27, 18:26

Search for whole words in file and folder names

Post by richardk »

How do you search for whole words in file and folder names? I am only seeing a choice to search for whole words within files.

Thanks
v 2.5.0.4
Win 8.1
Xplorer2 user since at least 2005
Kilmatead
Platinum Member
Platinum Member
Posts: 4797
Joined: 2008 Sep 30, 06:52
Location: Baile Átha Cliath

Re: Search for whole words in file and folder names

Post by Kilmatead »

You need to use Regular Expression mode for file-names.

In the <Ctrl+F> dialog, at the end of the "Named" field (where you enter filenames to search for) there is a number (usually 100). Set this to 0, then surround the "word" you want to search for with "\b" characters. Thus, to match only files/folders with "Richard" in the name as a whole word, use "\bRichard\b". This will match "This Porn Belongs to Richard Firestarter", but it will not match "This Porn belongs to Richard87 Firestarter".

Image

Unfortunately, there is a a bug in x2's reg-ex implementation where it does not appear to recognise matches at the beginning or end of strings - so if "Richard" appears at the beginning or end of the filename it will not be matched (this breaks the rules of the reg-expression "\b" definition) - however if it is anywhere in the middle, it will work fine.

Nikos, consider this a bug-report. :wink:
Last edited by Kilmatead on 2014 Jun 08, 21:43, edited 1 time in total.
richardk
Silver Member
Silver Member
Posts: 188
Joined: 2007 Mar 27, 18:26

Re: Search for whole words in file and folder names

Post by richardk »

Great, thanks.
Kilmatead wrote:Unfortunately, there is a a bug in x2's reg-ex implementation where it does not appear to recognise matches at the beginning or end of strings - so if "Richard" appears at the beginning or end of the filename it will not match - however if it is anywhere in the middle, it will work fine.
Wait isn't that a huge problem? The reg expression doesn't seem very useful with that limitation, at least for my own purposes.
v 2.5.0.4
Win 8.1
Xplorer2 user since at least 2005
Kilmatead
Platinum Member
Platinum Member
Posts: 4797
Joined: 2008 Sep 30, 06:52
Location: Baile Átha Cliath

Re: Search for whole words in file and folder names

Post by Kilmatead »

richardk wrote:Wait isn't that a huge problem?
Yes it is a huge problem - except I only just discovered it about 10 minutes ago, when trying to figure out a way to answer your question. :D Unfortunately, Nikos does not instantly fix things as they appear in my brain. (He should, but he doesn't. :sad:)

Back when Nikos was implementing RegEx into search, he apparently didn't test for that condition in particular, and obviously no one else has ever tried to use it since either. (Hence the part that he should consider this thread a bug-report. :wink:)
Last edited by Kilmatead on 2014 Jun 08, 23:49, edited 1 time in total.
richardk
Silver Member
Silver Member
Posts: 188
Joined: 2007 Mar 27, 18:26

Re: Search for whole words in file and folder names

Post by richardk »

Kilmatead wrote: obviously no one else has ever tried to use it since either. (Hence the part that he should consider this thread a bug-report. :wink:)
How is it even possible that I have four major problems in Xplorer2 that no one else has? I swear this is not the case with other programs.

- whole word search failure
- random columns showing up without any action on my part
- bookmarks vanishing then reappearing
- thumbnails wrongly rotated

That's just a rhetorical question. I don't really expect an answer although any insights would be appreciated.
v 2.5.0.4
Win 8.1
Xplorer2 user since at least 2005
Kilmatead
Platinum Member
Platinum Member
Posts: 4797
Joined: 2008 Sep 30, 06:52
Location: Baile Átha Cliath

Re: Search for whole words in file and folder names

Post by Kilmatead »

In the case of whole-word search, this is not a "major" problem - simply a small bug with x2's implementation of search RegEx - Nikos will be looking into it. Not every condition can be checked for, especially rare ones... most people don't even know how to use RegEx never mind actually do it on a daily basis in x2, so these things aren't discovered often. :shrug:

As I stated in the other thread, "x2 is not like other programmes in that it deals directly with the windows shell/COM and as such can be affected unexpectedly in return if something on the shell level (especially in the case of bugged-extension-handlers) is not kosher and/or is somehow corrupted."

Regarding your other difficulties with columns, vanishing bookmarks, thumbnails rotating (?) - these point to maleware/registry/shell corruption. If others cannot recreate them (or have never seen them in the first place), there is no magical solution, as x2 simply does not have these problems in the vast majority of installations, especially where user-error can be ruled out.

Thumbnail EXIF orientation is not native to Windows cache generation, so it's not a "bug" as such; x2 does not create thumbnails, it takes them from Windows itself, and in this case, Windows is just doing what it's supposed to (on Win7).
User avatar
nikos
Site Admin
Site Admin
Posts: 16295
Joined: 2002 Feb 07, 15:57
Location: UK

Re: Search for whole words in file and folder names

Post by nikos »

the regexp implementation is wholly outside xplorer2 and I cannot change it. Perhaps there are other ways to do it, regexp have an extremely complicated syntax, see the quickstart guide (HELP menu) for more information

xplorer2 is a complex program and as such you can misconfigure it in a variety of ways. That doesn't mean it is bugged or spooked. E.g. for your columns most probably you have used custom folder settings (see your other question) in a few folders

for better words-only control check out deskrule
Robert2
Gold Member
Gold Member
Posts: 700
Joined: 2004 Jun 17, 15:39

Re: Search for whole words in file and folder names

Post by Robert2 »

What about this kind of search (with star+space characters enclosing the search string):
* Soft *
On my system, xplorer² only found “Hard & Soft Links” as a folder name. It was the only file or folder with exactly “Soft” in the name.
Using:
\bSoft\b
Gave me no results.
Using star characters without the space characters:
*Soft*
Gave me tons of results (51) containing the “soft” string (Microsoft, Software, Soft, Thornsoft, etc.)
HTH.
Cheers,
Robert
Kilmatead
Platinum Member
Platinum Member
Posts: 4797
Joined: 2008 Sep 30, 06:52
Location: Baile Átha Cliath

Re: Search for whole words in file and folder names

Post by Kilmatead »

nikos wrote:the regexp implementation is wholly outside xplorer2 and I cannot change it. Perhaps there are other ways to do it, regexp have an extremely complicated syntax
Codswallop. If whatever implementation you are using cannot adhere to the basic rules of RegEx (encased with \b for word-search is as common as you get), then do not claim to support RegEx. External? That mean you just lifted the code from some free project? If you're using anything that is PCRE-compatible by which \b delimits using any whitespace (includes null, as in beginning/end) then your method of passing UTF strings into it must be flawed.

Under all the RegEx-enabled programmes (search or otherwise) I have (and can test), \bRichard\b matches all word-only text found in filename strings, regardless of where the word is in the text-line, that's exactly how it works and that's exactly how it's supposed to work.
nikos wrote:That doesn't mean it is bugged or spooked.
This is obviously a bug in your pseudo-implementation of RegEx, not an "oh, it's external", or, "oh, it's just you", or, "oh, it's very complex", or, "oh, your syntax is wrong" explanation. Condescension to users is not a good approach for a Monday morning. It's your bug, dude, own up to it.

---

Robert2, in order to use RegEx in the named search, the fuzzy-match-number (as shown above) in x2 must be 0, nothing else. Placing spaces between the wildcards and the text would not work as that seeks a literal space character, not all whitespace, thus it too would (and does) fail on anything at the beginning and end of a text.