perlquestion
mogmismo
<p>So, I'm trying to match, in a string, all values that are abbreviations. In this string:</p>
<P>"a history of u.s. coast guard aviation."</P>
<p>I would like the "u.s." to become "us" but not replace any other periods. Another example would be taking "M.C. Esher" and converting to "MC Esher"</p>
<p>So far, I can remove the middle dot, with a:</P>
<code>$string =~ s/(?<=\w)\.(?=\w)//g;</code>
<p>But I can't figure out how to do a lookahead/lookbehind/lookahead/lookbehind... I've tried this, and it fails:</p>
<code>$string =~ s/(?<=\w)\.(?=\w)\.(?=\s)//g;</code>
<p>Any ideas, Monks?</p>