TIP: searching using regular expressions

dhein's Avatar

dhein

02 Jan, 2018 01:41 PM

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.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac