foo <- "TF_list_to_test10004/Nus_k0.345_t0.1_e0.1.adj:PKMYT1" # Remove all before and up to ":": gsub(".*:","",foo) # Extract everything behind ":": regmatches(foo,gregexpr("(?<=:).*",foo,perl=TRUE))
sub(".*? ", "", D$name)