所有破折号分开的数字我想提取从在C字符串中的所有破折号分开的数字(这样232-65)++使用升压正则表达式 我使用此图案提取物使用升压正则表达式
\\d*-\\d*
但只有第一匹配是检测。我应该如何提取所有匹配的模式。
例如输入:
"2 1 5-25 37 42 43 53 69-119 123-514"
放出来只有5-25,但必须是5-25 69-119 123-514
我的示例代码是
cmatch res;
boost::regex port("\\d*-\\d*");
regex_search(s,res, port);
for (unsigned int i = 0; i < res.size(); ++i) {
cout << res[i] << endl;
}