Boost logo

Boost :

Subject: Re: [boost] [Regex] Why doesn't this pattern match?
From: John Maddock (john_at_[hidden])
Date: 2009-12-07 11:24:28


> can, please, somebody explain, why this code doesn't work?
>
> std::wstring str = L"Line \\n line \\n line \\n";
> std::wstring result = L"";
> const boost::u32regex e = boost::make_u32regex(L"\\n");
> std::wstring newText = L"\n";
> result = boost::u32regex_replace(str, e, newText);
>
> After launching result == str... :(((

You're replacing each occurrence of \\n with \\n, so the string at the end
should be exactly the same! :-)

Unless I'm missing something yours, John.


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