Here is a sample:
regex expression(
\\d+);
string text;
// Read the text into the string "text"...
cmatch matchStr;
if(regex_search(text.c_str(), matchStr, expression))
{
for(int i=0; i<matchStr.size(); i++)
{
cout<<"Number :"<<matchStr[i].str()<<endl;
}
}
You can get more samples about the regular expression using in boost document:
http://www.boost.org/doc/libs/1_37_0/libs/regex/doc/html/boost_regex/ref/regex_search.html#boost_regex.ref.regex_search.examplesSincerely,
Wesley
Please mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.