[R] Help with Regular expression
David Wolfskill
r at catwhisker.org
Wed Jan 3 15:32:05 CET 2018
On Wed, Jan 03, 2018 at 07:56:27PM +0530, Christofer Bogaso wrote:
> Hi,
>
> I was working on following expression :
>
> "\":\"03-JAN-2018 16:00:00\""
>
>
> This is basically a combination of Date and Time mixed with some Noise.
>
> I want to extract only Date and Time part i.e. "03-JAN-2018 16:00:00
>
> I tried following :
>
> gsub("![0-9][0-9]-[a-zA-Z][a-zA-Z][a-zA-Z]-[0-9][0-9][0-9][0-9]
> [0-9][0-9]:[0-9][0-9]:[0-9][0-9]", "", "\":\"03-JAN-2018 16:00:00\"",
> ignore.case = TRUE)
>
> Obviously, with above code, I am removing that portion of my string
> which I actually I wanted!
>
> How can I reverse above code, so that I will be removing that portion
> of my string which I actually I ***NOT*** wanted?
> ....
You may find strptime() more suitable for the intended purpose.
Peace,
david
--
David H. Wolfskill r at catwhisker.org
If you want the best Fake News, go to the best source of it: Donald J. Trump.
See http://www.catwhisker.org/~david/publickey.gpg for my public key.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 603 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20180103/0f273b60/attachment.sig>
More information about the R-help
mailing list