hi there,
I am working with a TAG-oriented text with boost:regex. For example,
the following pattern might occur in the text
<before> <pre><p>Some Text</p></pre> <after> <pre> ddd </pre>
In this case, I would like to extract everything between <pre> </pre>.
Meanwhile, everything outside <pre> </pre> should be unchanged except
that < is replaced by < and > is replaced by >
For that purpose, I tried the following code
boost::regex regexp("<\s*pre[^>]*>(.*?)<\s*/pre\s*>", boost::regex::icase);
boost::match_resultsstd::string::const_iterator what;
if (regex_search(sometext, what, regexp,boost::match_default|boost::format_first_only))
{
std::string between_tag = std::string(what[1].first, what[2].second) + "\r\n";
MessageBox(0, between_tag.c_str(), "", 0);
std::string left_tag(sometext.begin(), what[1].first);
std::string right_tag(what[1].second, sometext.end());
replace_all