Capitalize first letter of each line

Hey Tom,

Unfortunately and inexplicably ICU Regular Expression do NOT have a case-change operator…

This is one of the many reasons I keep the Satimage.osax AppleScript Extension on my system.

It’s fully Unicode-aware and makes that sort of thing simple.

set _text to "now is the time for all good men to come to the aid of their country."
set _text to change "\\b(.)" into "\\u\\1" in _text with regexp and case sensitive
--> "Now Is The Time For All Good Men To Come To The Aid Of Their Country."

Keyboard Maestro has some case-change filters (see the Filter Variable/Clipboard actions), but they’re not as versatile as using regular expressions.

Other than using the Satimage.osax your best bet is shelling-out to Perl, Python, Ruby, or JavaScript.

I prefer to use the Satimage.osax for its power and simplicity.

-Chris

1 Like