I want to extract a part of the string that comes before a certain word. E.g. I want to get everything before \", useless\".
a <- \"Experiment A, useless (03/
sub('(.*),.*','\\1', a, perl=T) [1] "Experiment A"