$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Christopher Hart (hartct_at_[hidden])
Date: 2006-05-21 15:57:32
I've run into a problem where I'm getting an "Invalid content of
repeat range" when attempting to match a string using greediness and
capture operators. I'm using the following function (basically taken
from the "print captures" example in the regex docs):
void find_matches(const std::string& regx, const std::string& text)
{
boost::regex e(regx, boost::regex::perl);
boost::smatch what;
std::cout << "Expression: \"" << regx << "\"\n";
std::cout << "Text: \"" << text << "\"\n";
if(boost::regex_match(text, what, e)) //, boost::match_extra))
{
... [snip] ...
}
else
{
...
}
}
... invoked by:
find_matches(html, "<p class=\"priceBest\"><a href=(.*?)>");
The pattern I'm trying to match is working in Perl program (e.g. if
($html =~ m|<p class="priceBest"><a href=(.*?)>|gs) {...} ), so it
seems like the pattern should be syntactically correct. I'm building
on Mac OS X 10.4 (Intel) with Boost 1.33.1.
I'm new to Boost and probably spoiled by Perl pattern matching, so I'm
guessing I'm missing something simple. Any help or suggestions are
appreciated!
Thanks,
Chris Hart