Using just builtin C++ objects and functions you could do something like the following:
Example Code
#include <iostream>
#include <string>
std::string getValue(const std::string &html)
{
static const std::string VALUE = "value";
static const char DOUBLE_QUOTE = '"';
std::string result;
std::size_t pos = html.find(VALUE);
if (pos != std::string::npos)
{
std::size_t beg = html.find_first_of(DOUBLE_QUOTE, pos);
if (beg != std::string::npos)
{
std::size_t end = html.find_first_of(DOUBLE_QUOTE, beg + 1);
if (end != std::string::npos)
{
result = html.substr(beg + 1, end - beg - 1);
}
}
}
return result;
}
int main()
{
std::string html = "<input type=\"hidden\" name=\"wtkn\" value=\"56e45dbe_wNIT/DcufUPvZOL33jmkyqGpKxw=\">";
std::cout << "HTML: " << html << "\n";
std::cout << "value: " << getValue(html) << "\n";
return 0;
}
Example Output
HTML: <input type="hidden" name="wtkn" value="56e45dbe_wNIT/DcufUPvZOL33jmkyqGpKxw=">
value: 56e45dbe_wNIT/DcufUPvZOL33jmkyqGpKxw=
Live Example
Note: Additional error checking may be required for a robust solution. This example implementation also has some preconditions (e.g., contains the value
keyword followed by the desired text between opening and closing double quotes).