Skip to content
Back to formatted view

Raw Message

Message-ID: <CA+dpOJmdDJ_e+yyRx9_aKH5PAE_ZvFXRETNaY69ga1E5TfAjWQ@mail.gmail.com>
Date: 2013-01-18T20:11:35Z
From: Christofer Bogaso
Subject: Working with regular expression

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)
[1] "  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,