qregularexpression

QT regularExpressions retrieve numbers

我的梦境 提交于 2019-12-02 06:42:44
问题 I've to split simple QStrings of the form "number number number",for example " 2323 432 1223". The code i use is QString line; QRegularExpression re("(\\d+)"); QRegularExpressionMatch match; while(!qtextstream.atEnd()){ line = qtextstream.readLine(); match = re.match(line); std::cout<<"1= "<<match.captured(0).toUtf8().constData()<<std::endl; std::cout<<"2= "<<match.captured(1).toUtf8().constData()<<std::endl; std::cout<<"3= "<<match.captured(2).toUtf8().constData()<<std::endl; } if the first