[R] Regular Expression

Michael Bedward michael.bedward at gmail.com
Mon Aug 9 04:23:59 CEST 2010


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)
>



More information about the R-help mailing list