$string =~ s!^(.*/).*?/$!$1!;