Boost logo

Boost Users :

Subject: Re: [Boost-users] [Q] regular expressions change the 'substitue with' value
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-06-26 19:54:47


AMDG

V S P wrote:
> Thank you,
> replace_all forks for me now.
>
> But probably will need to go back to regular expression in the future.
>
> I do not think I need to search, I just need to replace (in-place)
> I assume the find_XXX functions do not do that.
>
> I might have misunderstood but if I have a string
>
> "
> something!1!else!1!ornot
> "
>
> and I want to replace !1! with
>
> a new replacement text "c:\temp\file.xls",
>
> isn't the replace_all_regex the correct function to use?
>

No. replace_all_regex uses regex_formatter which is too fancy
because the format strings behave as described in
http://www.boost.org/libs/regex/doc/html/boost_regex/format.html

> if not, can you suggest an example with the combination of functions
> you have mentioned
>

boost::find_format_all(s, boost::regex_finder("!1!"),
boost::const_formatter("c:\temp\file.xls"))

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net