
Hello all, I have file output.txt, in file we can find something like: 01/01/2015 15:00:00 2222.2222 2222.2222 2222.2222 2222.2222 04/04/2015 15:00:00 2222.2222 and i would like to change format from DD/MM/RRRR HH:MM:SS to RRRR-MM-DD HH:MM:SS.000 using boost regex. But I have no clue how should I type pattern and replace them with another. Anyone have knowledge about boost regex and could help me ? Best regards

On 26/04/2015 16:06, Fu ji wrote:
Hello all, I have file output.txt, in file we can find something like:
01/01/2015 15:00:00 2222.2222
2222.2222 2222.2222 2222.2222
04/04/2015 15:00:00 2222.2222
and i would like to change format from DD/MM/RRRR HH:MM:SS to RRRR-MM-DD HH:MM:SS.000 using boost regex. But I have no clue how should I type pattern and replace them with another.
Anyone have knowledge about boost regex and could help me ?
To take only the first part of the problem, then off the top of my head, something like: boost::regex e("(\\d{2})/(\\d{2})/(\\d{4})"); Then if the contents of the file are in "mystring": mystring = regex_replace(mystring, e, "$3/$2/$1"); HTH, John.

Thank you for reply, John.
But after all I decided to write simple parser, and then write to new file
with proper format.
Best regards
2015-04-26 18:37 GMT+02:00 John Maddock
On 26/04/2015 16:06, Fu ji wrote:
Hello all, I have file output.txt, in file we can find something like:
01/01/2015 15:00:00 2222.2222
2222.2222 2222.2222 2222.2222
04/04/2015 15:00:00 2222.2222
and i would like to change format from DD/MM/RRRR HH:MM:SS to RRRR-MM-DD HH:MM:SS.000 using boost regex. But I have no clue how should I type pattern and replace them with another.
Anyone have knowledge about boost regex and could help me ?
To take only the first part of the problem, then off the top of my head, something like:
boost::regex e("(\\d{2})/(\\d{2})/(\\d{4})");
Then if the contents of the file are in "mystring":
mystring = regex_replace(mystring, e, "$3/$2/$1");
HTH, John.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (2)
-
Fu ji
-
John Maddock