diff --git a/src/Mod/Drawing/App/FeaturePage.cpp b/src/Mod/Drawing/App/FeaturePage.cpp index 79a1b3478..0b01e636f 100644 --- a/src/Mod/Drawing/App/FeaturePage.cpp +++ b/src/Mod/Drawing/App/FeaturePage.cpp @@ -159,23 +159,31 @@ App::DocumentObjectExecReturn *FeaturePage::execute(void) // checking for freecad editable texts string outfragment(ofile.str()); - if (EditableTexts.getSize() > 0) { + const std::vector& editText = EditableTexts.getValues(); + if (!editText.empty()) { boost::regex e1 ("(.*?)"); string::const_iterator begin, end; begin = outfragment.begin(); end = outfragment.end(); boost::match_results what; - int count = 0; + std::size_t count = 0; + std::string newfragment; + newfragment.reserve(outfragment.size()); while (boost::regex_search(begin, end, what, e1)) { - if (count < EditableTexts.getSize()) { + if (count < editText.size()) { // change values of editable texts boost::regex e2 ("((.*?)()"); - outfragment = boost::regex_replace(outfragment, e2, "$1>"+EditableTexts.getValues()[count]+"$3"); + boost::re_detail::string_out_iterator out(newfragment); + boost::regex_replace(out, begin, what[0].second, e2, "$1>"+editText[count]+"$3"); } - count ++; + count++; begin = what[0].second; } + + // now copy the rest + newfragment.insert(newfragment.end(), begin, end); + outfragment = newfragment; } // restoring linebreaks and saving the file @@ -188,13 +196,6 @@ App::DocumentObjectExecReturn *FeaturePage::execute(void) PageResult.setValue(tempName.c_str()); - //const char* text = "lskdfjlsd"; - //const char* regex = "lskdflds"; - //boost::regex e(regex); - //boost::smatch what; - //if(boost::regex_match(string(text), what, e)) - //{ - //} return App::DocumentObject::StdReturn; }