C++ (Qt)using boost::xpressive; std::string modifyString(const smatch& match){ std::string out(match[1]); std::reverse(out.begin(),out.end()); return out;} std::string in("a(bc) de(fg)"); sregex re = +_w >> '(' >> (s1= +_w) >> ')'; std::string out = regex_replace(in, re, modifyString); std::cout << out << std::endl;
C++ (Qt)std::string my_formatter(const smatch &)
C++ (Qt)template <class FormatFunc>QString regex_replace
C++ (Qt)typedef QString (*ReplaceFunc)( const QRegExp & rх ); // c QRegExp// илиtypedef QString (*ReplaceFunc)( const QStringRef & ref ); // без QRegExp
C++ (Qt)QString str = "text text <span></span> cd(ab) <a href="http://www.prog.org.ru/index.php?action=search;advanced"><img src="http://prog.org.ru/Themes/default/images/filter.gif" align="middle" style="margin: 0 1ex;" alt="" /></a>";QString out = ReplaceBlanks(str);