Boost logo

Boost :

From: Robert Dailey (rcdailey_at_[hidden])
Date: 2008-03-14 12:39:12


Currently I'm using Boost.Xpressive to search a string for variables that
will be replaced by localized utf-8 encoded strings, in the format of
$(variable_name). Because of this, I don't think I can simply use
regex_replace(), since it takes a common regex that will be used to replace
all matches, when in my case each match requires a special, unique
replacement. Is there a way of doing this using Boost.Xpressive, or do I
need to use a different component in the boost library? Is there a Xpressive
'replace' function that takes a functor, perhaps, and for each match it
calls the function object and replaces the match with the return value of
the functor?

An example of a string that I'll be searching is below:

"This string $(variable1) has localized $(var2) text interleaved for no

In the string above, we have 3 variables. Each variable will reference a
string in a localization table, which will then be used to replace the
variable itself.

Any help is greatly appreciated. Thanks.

Boost list run by bdawes at, gregod at, cpdaniel at, john at