Your example looks like the Title Case Macro, not the Sentence Case Macro. Let's see if I can upload the Sentence Case Macro that I'm having issues with. I believe it's identical to yours with the exception of the triggers (I removed the Hot Key trigger and use it as part of a palette.) Sentence Case.kmmacros (3.7 KB)
Ah, got it. Sentence not Title. Yes, that's a problem. Here's the solution (add the fourth line: s/'([stmdlrv])/'\l$1/gi;):
#! /usr/bin/env perl
use strict;
use warnings;
my @acronyms = qw( FBI CIA NASA );
my $acronym_list = join '|', @acronyms;
$_ = $ENV{KMVAR_LinkText};
s/(?<=\b[A-Z])[.]//gi;
$_ = lc $_ if not /[[:lower:]]/;
s/(^\w|[!\?\.'"’”]\s+\w|['"“‘]\w)/\U$1\E/g;
s/'([stmdlrv])/'\l$1/gi;
s/([A-Z]\.\s)([A-Z])/$1\L$2\E/g;
s/(,['"’”] )([A-Z])/$1\L$2\E/g;
s/\b($acronym_list)\b/\U$1/gi;
print $_;
Sorry for my initial confusion. Just speculating but I have a hunch the code couldn't distinguish between a closing single quote and apostrophe. This fix takes care of that.