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 <w...@mtmail.mtsu.edu> wrote: > > gsub(pattern = "^[0-9]+ (SPE )*(\\w+) - .*$", "\\2", dat) > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.