Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2004-02-25 06:29:42


> I am a newbie to regex. Can anyone please help? I am trying to replace
$number with a number 2 but instead it looks for argument number 12. What
is the format or escape sequence format_string variable needs to be?
>
> regex e("(\\$number)");
>
> const char* format_string = "(?12)";
>
> regex_replace(out, file_stream.begin(), file_stream.end(), e,
format_string, match_default | format_all);

Put some parenthesis around the 2:

const char* format_string = "(?1(2))";

John.


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