[R] Working with regular expression
ruipbarradas at sapo.pt
Fri Jan 18 21:58:12 CET 2013
This one seems to work.
gsub("[[:alpha:]_]*(.*)", "\\1", Text)
Hope this helps,
Em 18-01-2013 20:11, Christofer Bogaso escreveu:
> Hello again,
> I was trying to extract the date element from a character vector using
> Regular expression. Below is a sample what I was trying to do:
>> Text <- c("asdf May 09 2009", "dsaf_01-01-2001")
>> gsub("[a-zA-Z_]", "", Text)
>  " 09 2009" "01-01-2001"
> I basically have a long text and the task is to extract the date
> element. My above strategy failed because I can not extract the month
> for the first element.
> Can somebody help me out?
> Thanks and regards,
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help