Boost logo

Boost :

Subject: Re: [boost] [regex] embed string/char in regex w/o escaping?
From: Jim Bell (Jim_at_[hidden])
Date: 2011-03-02 10:43:24


On 1:59 PM, John Maddock wrote:
>> To your point of escaping a string wrong, I fiddled with a
>> regex_replace() that would remove all '\E' (end-of-quoted-sequence),
>> including '\\\E', but not touch '\\E' (i.e., even numbers of '\'
>> prefixing), and couldn't get it.
>
> I'm not sure I understand what you're trying to achieve there, can you
> explain?
>

I was going for different form, but (hopefully) same result as yours:

std::string my_escaped_string = "\\Q" + regex_replace(my_string, e,
"\\\\$&") + "\\E";


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