TIP: searching using regular expressions


#1

I just realized that on macOS the search feature allows regular expressions. I don't know whether this is documented anywhere (or whether there is any documentation at all).

This can be really useful. For instance I have a bunch of backing tracks I use for music practice. The tracks are in all keys and have names like Ab Maj7, C Maj7, Ab MinMaj7, C MinMaj7, Ab Maj7Sharp11, C Maj7Sharp11.

If I want to find all the tracks that just have "Maj7" in the title, and I simply searched for Maj7 then I'd get tracks with names that included Maj7 but also Maj7Sharp11 and MinMaj7. To get just the tracks ending with "Maj7" I can instead search for "Maj7$" ... but this still returns the MinMaj7 tracks as well. To get only tracks that include " Maj7" (with a leading space), I can search for "\sMaj7$" and this returns only the tracks that end with " Maj7".

That's really powerful. You have to know something about Regular Expressions (see Wikipedia), and have to guess which regular expression syntax is supported, but this is really very helpful and very powerful. Nice.