Automatically Capitalize Defined Names

Is it possible to have a single macro within Keyboard Maestro in which you list a bunch of names in lowercase under "Triggered by any of the following:", and Keyboard Maestro automatically capitalises those names whenever they're typed?

Say for example I've listed the names "jeff", "holly" and "dave" within the macro. Then I write this sentence in a text editor: "jeff was speaking to holly when dave interrupted them." I would like Keyboard Maestro to capitalise the names in real-time, after they're typed.

I understand I could create a single rule for each name, but I was wondering whether it was possible to create a simpler catch-all rule.



It's a little awkward, because you have to use a regular expression – but it's doable.

Type the name and a following <space> to activate.

Capitalize Proper Names when Typed v1.00.kmmacros (4.9 KB)

If I was maintaining a large list I'd write a macro to recreate the trigger in this using a list in a variable.

I wouldn't generally want to use a massive list in the regular expression, but I haven't experimented to see at what point Keyboard Maestro starts to bog down.


1 Like

That's great, thanks!

Would there be a way of implementing this without the space being required?

Removing the two brackets (with the space in the middle), at the end of the string, works. "[ ]".

Personally I'd want a terminator character.

Suppose you have “jill” and “jillian” or “jon” and “jonathon” in your list.

But of course YMMV.


1 Like

Not just one either. Period, comma, semi-colon, quote, exclamation point, question mark...


I know nothing about regex, but would I be right in thinking there's some way to include multiple alternative terminator characters within the square brackets?

Yep, that's what the brackets are all about:

[ .,;'"!?\t]

So try:

\b(?:dave|jeff|holly)[ .,;'"!?\t]

and add anything else you can think of to those brackets.


I didn't know much about regex either - still don't. This quick video series taught me much of what I needed to know, for my earlier regex related travels, using Keyboard Maestro:

Watching the Keyboard Maestro Forum wizards' posts fill in the complicated rest.


If you, or anyone, would like to learn how to write, read, and use Regular Expressions (RegEx), I'd suggest the following:

Getting Started with RegEx

Regular expressions (RegEx or RegExp) are extremely powerful, but have an initial steep learning curve that is often intimidating. But once you get over that initial hump, and you continue to write new RegExp, it will become much easier.

I do all of my RegEx development at this free website:

You may also find these sites helpful:

If you need a more formal, guided instructions to learn RegEx, see

The Complete Regular Expressions Course with Exercises 2020

  • The full course cost $10-12, 89% off regular price
  • But it has an extensive free preview so you can determine if you like the style or not.
1 Like