Hi,
I am new to boost Libraries and I am trying to find a substring using Boost::Regex
Lets say I want to find string "Hello" in "Hello world".
std::string completeStr = "Hello World";
std::string::const_iterator startOffset = completeStr.begin();
std::string::const_iterator endOffset = completeStr.end();
std::string searchWord= "Hello";
boost::regex expression(searchWord);
boost::match_flag_type flags = boost::match_any;
while(boost::regex_search(startOffset, endOffset, what, expression, flags))
{
int32 position = what.position(1);
int32 len = what[1].length();
}
but value of this position and length value is coming out to be -1.
It is not able to find this substring, Could anyone tell me what I am doing wrong ?
Subhash