http://qs321.pair.com?node_id=1067841


in reply to Lookahead/Lookbehind Regular Expression...

It sounds like you're just wanting to remove any periods that follow just one word character. I'm sure there might be a rare exception to this, but the following would accomplish that basic feat:
use strict; use warnings; my $str = "a history of u.s. coast guard aviation. M.C. Esher"; $str =~ s/(?<=\W\w)\.//g; print $str, "\n";
I'd also be tempted to force capitalization on those abbreviations, but that might not be what you're after:
# Remove periods and capitalize, so we have US instead of us. $str =~ s/(?<=\W)(\w)\./\U$1/g;
- Miller