Boost logo

Boost Users :

From: Eric Niebler (eric_at_[hidden])
Date: 2006-04-12 13:35:30


Lynn Allan wrote:
>
> The subsequent searches give valid information about the length and
> position, but other fields in the smatch:what variable seem invalid.
> regex_search( altDow.substr(32), what, rex)
> regex_search( altDow.substr(45), what, rex)

Watch out! altDow.substr(32) is returning a temporary string object.
After regex_search returns, the temporary is destroyed and the results
object is left holding iterators into a destroyed string.

> Regardless, I'm unclear how to tell which of the "groups" of
> subexpressions was "hit". With boost::regex there was a way to loop
> thru the boolean field:
> what[i].matched
> and see what "hit", but I am not seeing a comparable accessor.

Xpressive is no different that Boost.Regex in this regard.
what[i].matched is correct.

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net