The Basics of Making Advanced Searches With Wildcards and Filters

In a previous article I talked about searching for data in Windows or within Windows apps, using the Search box. Most of us have had times when we sort-of knew what it was we wanted to find, but didn’t remember the exact file name. In this article, I’m going to talk about some other ways to find what you want, some of which work better than others.

Using the most common wildcards: * and ?

Since the very beginning, Microsoft has allowed searches using two wildcards, the asterisk (*) and the question mark (?). In general terms, the question mark is used to substitute for one letter or symbol that you don’t know. The asterisk is used to substitute for many letters and symbols. Let’s try an example.

NOTE: I’m using the Start Menu search box here, but these techniques work in any search box.

In my last article, I showed what happened when I used the word "cat" as a search term in the Start Menu search box, which searches all your indexed files. Here’s a repeat of the picture.

Search in Windows 7

The result is a list of files that have the exact letter combination "cat" in their names. But let’s say I wanted to look for all the files with names very close to "cat." I’ll try substituting a question mark for the final letter T. As you can see, the results are very different!

Search in Windows 7

Why did it include all those file names that are way longer than "cat"? Because that is the way Search works. A wildcard character at the end of a search term only tells Search that I want to see the files whose names have the letters C-A followed by another letter, regardless of the length of the name. You’d think that just typing the letters C-A would be sufficient, but doing that turns up a completely different list of files.

Search in Windows 7

What if I tried searching with the question mark in the middle of the word? If the system works correctly, it would tell Search to find words where the letter T is two letters after the letter C, but the letter between them is unknown. But that’s not how it actually works. As you can see in this list, only four items on the list actually match the search criteria.

Search in Windows 7

Very confusing. Fortunately, there are ways to filter the search so you get closer to what you want, and I’ll talk about that in just a minute.

The other wild card, the asterisk, is used to represent many letters. As you can see by the examples above, Search already works as though you’d put an asterisk at the end of the word, so putting it there yourself is not necessary. Let’s say I wanted to search for all files that contain the letter C followed by the letter T, with any number of letters in between. I would search for C*T, and this is what happens. Sometimes there is considerable distance between the C and the T!

Search in Windows 7

As you can see, using wildcards isn’t always useful in turning up the information you’re looking for.

Getting better results with filters

If you know the type of file you’re looking for, you can specify it in the search, and thus not clutter up your results with all kinds of things that contain the right search term but are not what you’re looking for.

Let’s say I wanted to find photos of cats on my hard drive. I can tell Search to look for files with "cat" in the file name and one of the graphics file extensions, in this case, .jpg. So I would type in cat ext:.jpg as the search term.

Search in Windows 7

Why did all those files with cryptic file names turn up? Those are photographs that I’ve tagged with the keyword "cat". I could also have found those files by using the search term cat tag:cat.

We have covered tagging files and changing their metadata in previous tutorials. It takes time to do this, but the more information you add to your files, the easier they will be to find. Some good reads we recommend are the following: Tag People in Photos with Windows Live Photo Gallery 2011 and What is a File’s Metadata and How to Edit It.

Microsoft has provided over 100 search terms you can use to find what you want. The most commonly used are things like name, ext (also written filext or filextension), date, tag, and created (which is another way of specifying date). To see a list of what’s possible, open Windows Explorer and choose a folder (any folder will do).

Change to the Details view if you’re not already using that. See our tutorial here: Explaining the Windows Explorer Views.

Right-click on the column header labeled Name, and from the menu that appears, click More.

Search in Windows 7

Now you can find a scrollable list of all the currently available options for column headers in Windows Explorer, and the great thing is that any of these terms can be used to modify a search. As you can see, your files will have to include some of this information in their metadata (supplied by you, since a lot of it isn’t included automatically) or the search will turn up nothing.

Search in Windows 7

Searching, searching, searching...

The best way to become familiar with the ways Search can be used is to try it. You can’t cause any harm to your computer by looking things up in different ways, and you may be surprised at what turns up. When I was researching this article I found quite a few files that I no longer needed to keep around, and was able to free up some space on my hard drive by deleting them.

In the next article, I’ll discuss Microsoft’s major improvement - Natural Language Search - which means you don’t always have to use cryptic terms to find what you want: Experimenting with Natural Language Search in Windows Searches.

Related articles:

How to Use Search in Windows 7 and Customize the Search Index
Transform Windows Explorer with Filtering Options