Boost C++ Libraries: Ticket #13232: u32regex_replace - None of these prototypes have callback formatter capability https://svn.boost.org/trac10/ticket/13232 <p> I've had to do a workaround using a u32regex_iterator.<br /> This one takes parameters wstring, u32regex, and function address.<br /> (Internally it converts the wstring to u32string and does<br /> the replacement with the user callback). </p> <p> I just have to add more prototypes for the different forms<br /> needed, but it would be nice if I didn't have to do this. </p> <pre class="wiki">void U_Regex_Replace_Callback( X_string&amp; strSrc, U_X_regex&amp; Rx, X_32string (*func)(X_u32smatch) ) { X_32string str32Src, str32Repl, str32Out; WstrToU32string( strSrc, str32Src ); str32Out.clear(); boost::u32regex_iterator&lt;std::u32string::const_iterator&gt; i(boost::make_u32regex_iterator( str32Src, Rx)), j; U32SITR last = str32Src.begin(); while(i != j) { str32Out.append( (*i).prefix() ); str32Out.append( func( (*i) ) ) ; last = (*i)[0].second; ++i; } str32Out.append( last, str32Src.end() ); U32stringToWstr( str32Out, strSrc ); } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13232 Trac 1.4.3