I can extract the four line string with this fragment using C++ std::regex:
std::regex table("(<table id.*\n.*\n.*\n.*>)");
const std::string format="$&";
std::cout <<
std::regex_replace(tidy_string(/* */)
,table
,format
,std::regex_constants::format_no_copy
|std::regex_constants::format_first_only
)
<< '\n';
tidy_string()
returns a std::string
and code produces this output:
<table id="creditPolicyTable" class=
"table table-striped table-condensed datatable top-bold-border bottom-border"
summary=
"This table of Credit Policy gives credit information (column headings) for list of exams (row headings).">
How do I match on text that has a varying number of lines rather than exactly four? For example:
<table id="creditPolicyTable" summary=
"This table of Credit Policy gives credit information (column headings) for list of exams (row headings).">
or:
<table id="creditPolicyTable"
class="table table-striped table-condensed datatable top-bold-border bottom-border"
summary="This table of Credit Policy gives credit information (column headings) for list of exams (row headings)."
more="x"
even_more="y">