Boost C++ Libraries: Ticket #831: regex v1.33.1 match_results::format compile error in vc6 https://svn.boost.org/trac10/ticket/831 <pre class="wiki">Hello, I try boost v1.33.1 regex match_results::format in msvc6 sp6, but receive the following error: c:\program files\microsoft visual studio\vc98\include\xlocnum(267) : fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 1794) Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information Reproduce: VC6--&gt;Create a MDI application --&gt; add the following code: string strfind = "b(.)"; string Str = "abc"; string fmt = "x\\1y"; regex reg(strfind); smatch match; bool bFind = regex_search(Str, match, reg, match_default); if(bFind) { string Rep = match.format(fmt, format_default); } I want to know if there is any method to support match_results::format compile? Thanks. Jeffrey </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/831 Trac 1.4.3 John Maddock Sat, 17 Feb 2007 17:22:46 GMT status changed https://svn.boost.org/trac10/ticket/831#comment:1 https://svn.boost.org/trac10/ticket/831#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> <pre class="wiki">Logged In: YES user_id=14804 Originator: NO Unfortunately your compiler is known to be so buggy in this area that there's probably not much that can be done :-( I assume you can't use regex_replace instead? That is known to work with VC6. Alternatively if you take a peak at the code inside regex_replace you'll find that it basically has to do what you're trying to do, so you may find a workaround in there that will also work for your code. HTH, John Maddock. </pre> Ticket jeffreyren Mon, 19 Feb 2007 01:34:03 GMT <link>https://svn.boost.org/trac10/ticket/831#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/831#comment:2</guid> <description> <pre class="wiki">Logged In: YES user_id=1396355 Originator: YES Thanks for your reply. In fact I have tested regex_replace and it's OK. The only question regex_replace will replace first or all the occurrences in the string, what I want is to replace the last occurrence. BTW, is VC6+STLPort can support regex compile in vc6? </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Mon, 19 Feb 2007 13:54:58 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/831#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/831#comment:3</guid> <description> <pre class="wiki">Logged In: YES user_id=14804 Originator: NO Yes, regex_replace will replace the first occurance or all of them, not the last only. And yes it works with VC6+STLport as well. Looking at your error, the following code compiles OK for me with VC6, do you have the latest compiler service packs (it's up 5 or 6 now I think) installed? Otherwise it might be a case of fiddling around with your compiler settings / and or code until you find a combination that doesn't choke the compiler. John. Here's the code that works for me: #include &lt;boost/regex.hpp&gt; int main() { using namespace std; using namespace boost; string strfind = "b(.)"; string Str = "abc"; string fmt = "x\\1y"; regex reg(strfind); smatch match; bool bFind = regex_search(Str, match, reg, match_default); if(bFind) { string Rep = match.format(fmt, format_default); } return 0; } </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>jeffreyren</dc:creator> <pubDate>Wed, 21 Feb 2007 01:50:44 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/831#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/831#comment:4</guid> <description> <pre class="wiki">Logged In: YES user_id=1396355 Originator: YES Thanks John, I have found out why. I'm using VC6 SP6. Yes, you code works fine for general C++ project VC6 SP6. But the compiler error occurs only in VC6 mfc-relevant project. So the better choice seems to be vc6+stlport. Thanks again for your time! Jeffrey </pre> </description> <category>Ticket</category> </item> </channel> </rss>