Given a timestamp in ISO 8601 format below:
2012-04-21T01:56:00.581550
what regular expression would remove the decimal point and the millisecond precision? In other words, a regex that applies to the above and returns the following:
2012-04-21T01:56:00
This is probably very simple, but not being particular familiar with regex I am unsure how to approach the solution. Thanks in advance for any assistance.
If you must use regex, you can use
"[.][0-9]+$"and replace it with an empty string"".It is easier to locate the trailing
'.', and chop off the string at its index. In C#, that would be