Matching Typed String triggers before word breaks

Keyboard Maestro can match a Typed String trigger after a word break, but it cannot see in to the future, so it cannot match a Typed String trigger before a word break. And Keyboard Maestro cannot capture every possible next character (that would require a hot key for every character with every combination of modifiers), and even if it could, resubmitting the character would lead to out of order results.

But Keyboard Maestro can use a regular expression to match the Typed String trigger, and it can match for a reasonable set of word break characters, and then you can replace the Typed String text and the extra character with a new string, including that extra character.

Here is a simple example that will replace a “u” typed as a word, followed by any of .,;!"?- (expand the set as necessary) with “you” and the terminating character.

u ➤ you (Match before word break example).kmmacros (2.0 KB)

1 Like