1. what do you mean- wrong result?
2. I just tried to run:
std::string readBuffer = "dgsdg sdfgsd sdfg ds <&randomtag> fghhsdfgsd dfgd sdg dfgdg dfg ghdfh sdfg";
std::string starttag = "<&randomtag>";
std::string endtag = "";
size_t sstart;
size_t send;
sstart=readBuffer.find(starttag);
send=readBuffer.find(endtag);
std::string correction = readBuffer.substr(sstart,send-sstart);
and it worked as expected. correction variable was holding "<&randomtag> fghhsdfgsd dfgd sdg dfgdg dfg ".