Was going to suggest gsub("^[0-9]+ (SPE )?([^ -])( -.*)?", "\\3", s) but I see Wu Gong beat me to the punch with a nicer one :) On 9 August 2010 12:13, Wu Gong <wg2f at mtmail.mtsu.edu> wrote: > > gsub(pattern = "^[0-9]+ (SPE )*(\\w+) - .*$", "\\2", dat) >