$text = "U.S. Army\nthe Army has been berry-berry good to me\nUS-Army\nUS Army\n"; $text =~ s/\bArmy\b|U\.S\. Army/US-Army/g;