S
sgrm123
Guest
I want to extract string between open and close bracket.So if the content is
145(5)(7)
the output must be
5
7
I tried with C++ STL TR1 using below code
const std::tr1::regex pattern("\\((.*?)\\)");
// the source text
std::string text= "145(5)(7)";
const std::tr1::sregex_token_iterator end;
for (std::tr1::sregex_token_iterator i(text.begin(),
text.end(), pattern);
i != end;
++i)
{
std::cout << *i << std::endl;
}
I am getting the output as,
(5)
(7)
I want the output without delimiters.
Please help me to meet my requirement using STL TR1.
Continue reading...
145(5)(7)
the output must be
5
7
I tried with C++ STL TR1 using below code
const std::tr1::regex pattern("\\((.*?)\\)");
// the source text
std::string text= "145(5)(7)";
const std::tr1::sregex_token_iterator end;
for (std::tr1::sregex_token_iterator i(text.begin(),
text.end(), pattern);
i != end;
++i)
{
std::cout << *i << std::endl;
}
I am getting the output as,
(5)
(7)
I want the output without delimiters.
Please help me to meet my requirement using STL TR1.
Continue reading...