Command line and power tools
Most searches do not need regex. The ones that do usually cannot be done any other way.
Shell globs cover most cases and are far easier to read:
find ~ -name "report-202[456]-*.pdf"
* is any run of characters, ? is one, [456] is a character class. If a glob will do, use it.
find ~ -regex ".*/IMG_[0-9]{4}\.(jpg|heic)"
macOS ships BSD find, which uses basic regular expressions by default and has no -regextype flag. -E switches to extended syntax:
find -E ~ -regex ".*/IMG_[0-9]{4}\.(jpg|heic)"
Note that -regex matches the whole path, not just the filename — the leading .*/ is usually required and is the most common reason a pattern silently matches nothing.
grep -rE "invoice-[0-9]{6}" ~/Documents
-r recurses, -E gives extended regex, -l lists only filenames, -i ignores case.
| Goal | Pattern | ||
|---|---|---|---|
| Four-digit year | 20[0-9]{2} | ||
| Camera files | `(IMG\ | DSC\ | DSCF)_?[0-9]+` |
| Versioned names | -v[0-9]+ | ||
| Dated screenshots | Screenshot [0-9-]{10} | ||
| Anything but | ^(?!.*cache).*$ (needs PCRE, so grep -P or rg) |
A tool that accepts /pattern/ inline lets you use regex for the one search that needs it without leaving the interface. That is the right trade-off: plain typing for the ninety-nine cases, regex available for the hundredth.
It matches the entire path. Prefix your pattern with .*/ or use -name with a glob instead.
BSD grep has no -P. Install ripgrep or GNU grep via Homebrew if you need it.
Everywhere keeps track of every file on your Mac — including the folders Spotlight hides and drives you have unplugged. Free for a day, then $19 once.
Download for Mac