How to use wildcard characters in Spotlight search?

I'm used to using the search window in Windows that provided the ability to use options such as:

  • Date of Creation/Modification
  • File Size
  • File Extension
  • Wild Card Characters

How can I search with Spotlight with similar criteria?


This article has a lot of good information on maximising the power of Spotlight search. To search by date, for example:

Check the Date Looking for a file that was created during a specific time period? Spotlight has a handle on dates. Typing date:today will bring up files you created, read, received, or opened today. You can also use the date: keyword with yesterday and tomorrow (for the latter, Spotlight restricts its results to iCal events and to-do items).

The latest version of Spotlight also lets you specify more parameters (whether a file was created or modified on a certain date), as well as enter an exact date or a range of dates. For example, you can type created:12/25/07 to find files authored on that date; type modified:<11/30/06 to look for files changed before that date; or type created:1/1/06-12/31/06 to locate files created between these two dates. Unfortunately, date: keywords don’t seem to work correctly all the time.


Unfortunately it seems you can only do wildcard queries using "raw queries" which are typically associated with the mdfind command. For example (the c at the end makes it case-independent):

mdfind "kMDItemDisplayName=='*back*'c"

While you can't do Raw Queries from the simple Spotlight fields (menubar and upper right in Finder), you can use Raw Queries from Finder advanced search (aka Spotlight window). Jump to finder search in Finder using Command-F (or use the global shortcut Command-Option-Space). Then change the Kind to "Others > Raw Query":
Raw Query example

You can then click Save to add it as a Smart Folder in the Sidebar. To skip the Others and get to Raw Queries a little faster you can add Raw Query to the Kind drop-down menu: Adding Raw Query to menu

A little more info on mdfind and wildcards is at https://web.archive.org/web/20160307180844/http://www.macdevcenter.com/pub/a/mac/2006/01/04/mdfind.html?page=3. Also see this great superuser blog post by @slhck at Digging Deeper: Mastering Spotlight in OS X. The different attribute keys you can use is at Apple MDItemRef.