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("(\\w*), useless.*","\\1",a)