Message-ID: <f49fcd831001020708j2040f5cq3da421ce6698026a@mail.gmail.com>
Date: 2010-01-02T15:08:25Z
From: johannes rara
Subject: Regexp: extract first occurrence of date in string
I would like to extract first date from a string:
> txt <- "first date is 05.12.2009. Second date is 06.12.2009."
> txt
[1] "first date is 05.12.2009. Second date is 06.12.2009."
I tried:
> sub("^.*?\\s(\\d{1,2}\\.\\d{1,2}\\.\\d{4})", "\\1", txt, extended=T, perl=T)
[1] "05.12.2009. Second date is 06.12.2009."
>
How to modify this?
-J