fork download
  1. Valid_Countries <- c("US", "CA", "JP", "AU", "DE", "IT", "ES", "FR", "UK", "FI", "SE", "NO")
  2. CountryCode <- c("JP", "MN")
  3. p <- paste0("(?s)^(?!(?:", paste(Valid_Countries, collapse="|"), ")$).*")
  4. gsub(p, "OtherCountry", CountryCode, perl=TRUE)
Success #stdin #stdout 0.22s 39576KB
stdin
Standard input is empty
stdout
[1] "JP"           "OtherCountry"