I am new to the forums, so I apologize if this has been posted before and I didn’t find it.
I would like to know whether Keyboard Maestro’s search-and-replace regular expressions support changing case in replacement text. I have a macro that runs through the text on the clipboard performing a variety of search-and-replace operations using regular expressions. For some of them, I would like for it to change the case of text in a capture group in the replacement text. The standard regular expression operators to change case (\u, \U, \l, etc) do not seem to work in Keyboard Maestro. Is there a way to get Keyboard Maestro to do this?
Nope. The ICU regex library in OSX does not support the case-change operator. (Damn it.)
(The Help Menu in the KM Editor contains a link to the syntax page.)
You can always shell-out to Perl, Python, or Ruby, but I usually use AppleScript and the Satimage.osax for jobs like that. It only supports \u and \l, but those usually get me by.
Thanks very much for your response. I had seen the syntax page, but was just hoping I was missing something. I think for what I’m doing, sending it out to a scripting language is overkill. Too bad.
I had the same issue as in this thread, but as it happens I have BBEdit, and the regex engine in BBEdit (viz. PCRE) does support case modification in replace. So I’m using an Apply BBEdit Text Factory and doing a grep replace in a BBEdit text factory. It seems to work fine for me so far.