Boost logo

Boost :

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


> The replacement is "\n" not "\\n" so the '\' followed by 'n' in str should
> be replaced with a newline, right?

No, a regular expression of \\n matches a single newline character - the
first \ is swallowed by the compiler, then Boost.Regex gets to see the
expression "\n" which it interprets as "match a newline".

John.


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