Boost logo

Boost Users :

From: llwaeva_at_[hidden]
Date: 2007-04-24 02:57:19


Hi there,
  I am using replace_all_regex to do a batch replace, for instance

replace_all_regex( source, boost::regex("(xxx)|(yyy)"), string("(?1 FIRST)(?2 SECOND)"), format_all );

the format string is seperated with (?N XXX) pattern, where N is a decimal number. Using the format string shown above,
all xxx will be replaced with " FIRST" (no quotation mark) and yyy will be replaced with " SECOND" (no quotation mark)
instead of "FIRST" and "SECOND" (no extra space). Someone said the problem can be solved by rewriting the format string
as

string("(?1FIRST)(?2SECOND)")

However, if the replacing string also begins with a decimal string, this approach doesn't work. For example, if I want to
replace xxx with "55FIRST" (without quotation mark), the following function will TRANSLATE: replace the N0. 155 pattern
with FIRST, but not replace N0.1 pattern with 55FIRST

replace_all_regex( source, boost::regex("(xxx)"), string("(?155FIRST)"), format_all );

How can I solve such probelm?

Thanks


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