Opened 16 years ago

Closed 16 years ago

#671 closed Bugs (Fixed)

regex_match fails, but regex_search works fine

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

Description

I encountered this when I tried to upgrade from 1.32 
to 1.33.1

I search through a text with regex_search, and pass 
the results to regex_match. I would expect them to 
yield the same result, but they don't.

Here is a sample code:

	std::string pattern = "xx-{0,2}([+-][0-9])?";
	boost::regex reg(pattern.begin(), pattern.end
(), boost::regex::perl_syntax_group );

	char* buf = "xx-- ";
	boost::cmatch what;

	regex_search(buf,what,reg, 
boost::regex_constants::match_default);
	bool match = regex_match(what[0].first, what
[0].second,reg, boost::regex_constants::match_any);


regex_search returns the [0,4), as I expected, but 
regex_match returns false!

Am I doing something wrong? Is there a workaround?

Thanks, Moddy.

moddyt@itemfield.com



Change History (2)

comment:1 by John Maddock, 16 years ago

Logged In: YES 
user_id=14804

I've confirmed this as a bug in the current release, you
could try defining BOOST_REGEX_NON_RECURSIVE in
boost/regex/user.hpp as a temporary workaround and
rebuilding everything (including the library).

comment:2 by John Maddock, 16 years ago

Status: assignedclosed
Logged In: YES 
user_id=14804

This is now fixed in cvs.
Note: See TracTickets for help on using tickets.