fork download
  1. x <- c("gender_gender-1", "county_county-2", "country_country-1997", "country_country-1993", "county-county-county-2")
  2. gsub("^(.*?)(?:[,_\\s-]\\1)+", "\\1", x, perl=TRUE)
Success #stdin #stdout 0.23s 183680KB
stdin
Standard input is empty
stdout
[1] "gender-1"     "county-2"     "country-1997" "country-1993" "county-2"