Re: [Boost-users] why the following regexp doesn't meet my requirement?
But, as I mentioned above, the whole matached string, namely #P{x}, will be replaced once the match is found. So, the character [^#] will also be replaced, that is not what I want.
Try a negative lookbehind: "(?does not form part of the result.
John.
Thank you so much. It's amazing! I see that regex is really a powerful tool! BTW, in order to replace the pattern #P and avoid the string start with double #, I find it is all right to specify the exact times in matching when using replace_all_regex, for example replace_all_regex( source, boost::regex("([#]\{1\}P)|([#]\{1\}G)"), string("(?1 FIRST)(?2 SECOND)"), format_all ); of course, using the "negative lookbehind" approach also works in this problem replace_all_regex( source, boost::regex("((?
participants (1)
-
llwaeva@21cn.com