Modify

Opened 7 years ago

Closed 7 years ago

#3941 closed Bugs (invalid)

match_results relies on string evaluated by regex_search()

Reported by: David Klamet <davek@…> Owned by: John Maddock
Milestone: Boost 1.43.0 Component: regex
Version: Boost 1.40.0 Severity: Optimization
Keywords: Cc:

Description

See example: If "text" is altered or destroyed, "matches" becomes invalid. Is this the desired behavior?


string pattern="
s*:(
S+)
s*"; string text=" :command ";

boost::regex re(pattern);

boost::match_results<string::const_iterator> matches; bool stat=boost::regex_search(text, matches, re); text=""; Truncate string cout<<matches[1].str()<<endl; <<Throws sting iterator not dereferencable exception

Attachments (0)

Change History (1)

comment:1 Changed 7 years ago by John Maddock

Resolution: invalid
Status: newclosed

This is by design: match_results store iterators, not strings.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain John Maddock.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.