Boost logo

Boost :

Subject: Re: [boost] [regex] Change format of data in file
From: Fu ji (fujimailing_at_[hidden])
Date: 2015-04-28 08:50:00


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 <jz.maddock_at_[hidden]>:

>
>
> 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
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk