Prepending and Appending Text to a Selected String

I would like a macro that prepends and appends text to a selected string, i.e., if I select:


... I get:


(But without the italics this forum software apparently generates when I use asterisks.)

I've taken some initial action, but am stumped on the replace part.

Try putting a \ before the * to so it looks like this \*

That will tell the forum software that you mean "a literal asterisk" instead of "a Markdown indicator for italics".

Using \ might also help in Keyboard Maestro since * is considered a special character for regular expressions.

Just some untested thoughts

No need to search the text or even set a variable. You can just do something like this:

Example Macro.kmmacros (1.3 KB)


Brilliant, and elegant. Thank you!

1 Like