Modify

Ticket #3941 (closed Bugs: invalid)

Opened 4 years ago

Last modified 4 years ago

match_results relies on string evaluated by regex_search()

Reported by: David Klamet <davek@…> Owned by: johnmaddock
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

Change History

comment:1 Changed 4 years ago by johnmaddock

  • Status changed from new to closed
  • Resolution set to invalid

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

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


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

 
Note: See TracTickets for help on using tickets.