How can I use Regular Expressions in Spotlight on Mountain Lion?
Apple's tools for accessing the Spotlight index (Spotlight itself and the mdfind
command) don't offer any regex options, nor do I know of any 3rd party tools that offer that (I'm not actually sure Apple has APIs that would make that possible).
However, the mdfind
command does offer a much more powerful interface than the GUI Spotlight search. It offers proper binary operators and finer grained control over what metadata you search. Check out The Power of mdfind (via archive.org) for some good information, as well as the mdfind man page.
I found a couple alternatives to Spotlight that allow for more control over your searches. Like the mdfind
command the Canuck suggested, some of the tools enable you to use boolean operators.
Alternative 1: Find Any File
Find any file is very basic when you first look at it, but once you click the "More Choices" button, many more options pop up so you can refine the search by including more parameters like those seen in the image of a menu:
Alternative 2: NotLight
Although I prefer NotLight to Spotlight, it's search is not as powerful as that of Find Any File and you're not given as many parameters to search by. However, you can search within a specific folder, which is a useful feature.
Alternative 3: EasyFind
EasyFind is by far the most user friendly Spotlight alternative and has the nicest user interface. It is better then NotLight, but does lack some of the functionality of Find Any File. However, if you're the average user and are not looking for incredibly specific search capabilities, then this would probably be the best option.
Hope you found some of these tools useful!