Hi there, I found that the behavior of replace_all_regex is weird while specifing format flag as format_literal. For example, I would like to replace %f and %g in a source with some text respectively. The code is string source = "#f = %f \r\n #g = %g \r\n"; string text1("<footi@tv.com>"); string text2("""name""<name@email.101.pi>"); replace_regex(source, boost::regex("%f"), text1, boost::regex_constants::format_literal); replace_regex(source, boost::regex("%g"), text2, boost::regex_constants::format_literal); The result is fine. However, I would like to use replace_all_regex instead. i.e. replace_all_regex( source, boost::regex("(%f|%g)"), string("(?1 loofon@56.com)(?2 ""name""<name@email.101.pi>"), boost::regex_constants::format_literal); However, because of format_literal, what I get is #f = (?1 loofon@56.com)(?2 "name"<name@email.101.pi>") #g = (?1 loofon@56.com)(?2 "name"<name@email.101.pi>") rather than #f = loofon@56.com #g = "name"<name@email.101.pi>" In my case, I need to handle a heap of patterns and using replace_all_regex is convenient. Any way to use both replace_all_regex and format_literal without going into the trouble mentioned above? Thanks in advance.