[R] Regular Expression

Michael Bedward michael.bedward at gmail.com
Mon Aug 9 04:25:11 CEST 2010


And my \\3 should have been a \\2 anyway !

On 9 August 2010 12:23, Michael Bedward <michael.bedward at gmail.com> wrote:
> 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