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

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to