对某一字符串的所有数字遍历提取,代码如下 QString str = "lisjsux89"; QRegExp rx("(\\d+)"); QString type; int pos = 0; while ((pos = rx.indexIn(str, pos)) != -1) { type.append(rx.cap(1)); pos += rx.matchedLength(); }