Opened 17 years ago

Closed 17 years ago

#519 closed Bugs (Invalid)

Problems in regex in MS Visual Studio.NET 2005

Reported by: mbobka Owned by: John Maddock
Milestone: Component: regex
Version: None Severity:
Keywords: Cc:

Description

When I try to run this code:

#include "stdafx.h"
#define BOOST_REGEX_MATCH_EXTRA
#include <boost\regex.hpp>

int _tmain(int argc, _TCHAR* argv[])
{
	boost::regex	re( "^(?:(.+?),)*(.+?)$" );
	boost::cmatch	matches;

	if( boost::regex_match( "hello", matches, 
re ) ) {
		for( boost::cmatch::iterator pos = 
matches.begin() + 1; pos != matches.end(); pos++ ) {
		}

		return 1;
	}

	return 0;
}

compiled by Visual Studio.NET 2005, assertion will be 
failed at 
boost_1_33_1_beta\boost/regex/v4/match_results.hpp, 
line 282 (Assertion failed: pos+2 < m_subs.size()).

If I undefine BOOST_REGEX_MATCH_EXTRA, then all is OK.

Change History (1)

comment:1 by John Maddock, 17 years ago

Status: assignedclosed
Logged In: YES 
user_id=14804

If you want to use extended capture information then you
have to build the regex lib with BOOST_REGEX_MATCH_EXTRA
defined.  I suggest you define it in boost/regex/user.hpp. 
If you do that then your example runs as expected.

John Maddock
Note: See TracTickets for help on using tickets.