Hello, I'm trying to use boost regex'es replace and add a trailing 0 after the \1 part. However, it seems to want to replace this with \10, which is not what I want. Anyone has any idea how to do this in a proper way ? Thanks in advance! Regards, Leon Mergen
On Fri, 3 Dec 2004 14:00:01 +0100, Leon Mergen
Hello,
I'm trying to use boost regex'es replace and add a trailing 0 after the \1 part. However, it seems to want to replace this with \10, which is not what I want.
Anyone has any idea how to do this in a proper way ?
Thanks in advance!
Regards,
Leon Mergen
If you use the 'format_all' flag, you can use something like ($1)0 as a format string. For example, boost::regex_replace(std::string("Hello"), boost::regex("([a-zA-Z]+)"), "[($1)0]", boost::regex_constants::format_all); yeilds the string "[Hello0] HTH Stuart Dootson
On Fri, Dec 03, 2004 at 02:25:56PM +0000, Stuart Dootson wrote:
I'm trying to use boost regex'es replace and add a trailing 0 after the \1 part. However, it seems to want to replace this with \10, which is not what I want. Anyone has any idea how to do this in a proper way ?
If you use the 'format_all' flag, you can use something like ($1)0 as a format string.
Ahhh ,thanks, that worked like a charm! :-) Regards, Leon Mergen
participants (2)
-
Leon Mergen
-
Stuart Dootson