此正则表达式将在换行符处修剪字符串。我希望它只
修剪两端并保留中间的任何换行符。
string s(" Stack \n Overflow ");
boost::regex expr("^[ \t]+|[ \t]+$");
std::string fmt("");
cout << boost::regex_replace(s, expr, fmt) << endl;
此正则表达式将在换行符处修剪字符串。我希望它只
修剪两端并保留中间的任何换行符。
string s(" Stack \n Overflow ");
boost::regex expr("^[ \t]+|[ \t]+$");
std::string fmt("");
cout << boost::regex_replace(s, expr, fmt) << endl;