Windows – How to search only the filename for a substring in Windows

windows 7windows 8windows-search

Following on from this question, I'd like to know whether Windows Search also shares the same shortcomings, or whether it is possible using Advanced Query Syntax to search for a substring in the filename only, leaving out the extension?

What I mean is, is it possible to search for something like, say, "zip" in only the filename such that the following valid filenames are returned?

zip
has zip
zip.doc
azip.zipx
textzip.txt
has zip text
File.zip.txt
zipper.winzip
File - zip text.zip
this file name haszipin it.txt

The following are invalid filenames since they do not contain the string "zip" in the filename portion, but only in the extension. These should be excluded.

noname
File.xzip
File.zipx
File.azipx
File.bxzip
File name.zip

Best Answer

You could exclude zip files from the index but I know that isn't really answering your question. I use a freeware program called Everything that lets me choose what files to index and you can use regular expressions in that search in order to get more exact results (like what you're looking for). As far as I'm aware, windows search doesn't allow regular expressions but maybe you can attach a second parameter to the search like *zip*.* && not *.zip Not sure if that's possible though.


Edit: Since I (Karan) just tweaked Codezilla's last attempt posted in chat, it wouldn't be proper to add it as a separate answer. All credit goes to him (Edit: and to Scott as well) for discovering 95% of this search term, which seems to correctly identify the 10 valid filenames and leave out the 6 invalid ones:

*zip* NOT "*.*zip*" OR filename:"*zip*.*zip*"

So it can be done, but not without jumping through hoops. Confirmation of the fact that Windows Search sucks. Couldn't they have simply added proper RegEx support?

Related Question