Opened 21 years ago

Closed 21 years ago

#44 closed Bugs (Fixed)

regex_match bidirectional-iterator bug

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

Description

in your boost regex library doc, you wrote:
-------------------------
The algorithm regex _match determines whether a given 
regular expression 
matches a given sequence denoted by a pair of 
bidirectional-iterators, the 
algorithm is defined as follows, note that the result 
is true only if the
expression matches the whole of the input sequence, the 
main use of this 
function is data input validation: 

template <class iterator, class Allocator, class charT, 
class traits, class
Allocator2>
bool regex_match(iterator first, 
                 iterator last, 
                 match_results<iterator, Allocator>& m, 
                 const reg_expression<charT, traits, 
Allocator2>& e, 
                 unsigned flags = match_default);
-------------------------
at the same time you use in regex_match.hpp:
-------------------------
restart += len;
-------------------------
which means iterator should have to be random-access 
rather than
bidirectional-iterator.
a very simple resolution would be :
std::advance(restart, len);
and in case of random-access this compiles to += on
a good c++ library implementation

Change History (2)

comment:1 by John Maddock, 21 years ago

Logged In: YES 
user_id=14804

That should be fixed in the cvs now, thanks!

comment:2 by John Maddock, 21 years ago

Status: assignedclosed
Note: See TracTickets for help on using tickets.