How to extract all the strings before the second colon in r?
Advertisements I have a time data looks like this: 2024-01-26 19:24:40.0 I want to extract everything before the second colon like this: 2024-01-26 19:24 I tried the code as below: a="2024-01-26 19:24:40.0" b=sub("(^([^:]+:){2}).*$", "\\1",a) But the result was like this: 2024-01-26 19:24: So how to write the code in the right way? >Solution : Option… Read More How to extract all the strings before the second colon in r?