go ahead... be a heretic | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
So, I'm trying to match, in a string, all values that are abbreviations. In this string: "a history of u.s. coast guard aviation." 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" So far, I can remove the middle dot, with a: $string =~ s/(?<=\w)\.(?=\w)//g;But I can't figure out how to do a lookahead/lookbehind/lookahead/lookbehind... I've tried this, and it fails: $string =~ s/(?<=\w)\.(?=\w)\.(?=\s)//g;Any ideas, Monks? In reply to Lookahead/Lookbehind Regular Expression... by mogmismo
|
|