boost::regex re("W=\\w+");
boost::regex sre("!NULL|sil|SIL");
string s, sbuf;
string::const_iterator begin, end;
size_t length;
sbuf = phrase;
begin = sbuf.begin();
end = sbuf.end();
boost::match_results<std::string::const_iterator>matches;
boost::match_flag_type flags = boost::match_default;
while(boost::regex_search(begin, end, matches, re, flags))
{
if(boost::regex_search(phrase, re))
{
s= matches.str();
length=matches.str().size();
string item =s.substr(2,length-1);
if(boost::regex_match(item,sre))
break;
else{
phraseList.addString (item.c_str());
break;
}//else
} //if
}//while
// Parse the line
len=strlen(phrase);
//If the phrase is a content bearing term, put it into phrase list while(i<len){ if(phrase[i] != 'W')i++;
else{i=i+2;
item=&phrase[i];
if (strncmp (item,"!NULL ",6) == 0|| strncmp(item,"sil ",4)==0 || strncmp(item,"SIL ",4)==0) break; else {memcpy(phrase, item, strlen(item)+1);
phraseList.addString (phrase);
break;}
}
}
I don't like the second option in spite of the fact that it works. Moreover, I want to use boost.regex for other complex tasks and I want to test it with this simple real life problem. Your input is highly appreciated!
Thank you in advance!
Best regards,
mmoges
_______________________________________________