Добрый день.
Имеется код:
QString st = "1,2,3,4,5-6,7,8,9";
QRegularExpression regexp("(?:\\,|^)\\d+(?:\\,|$)");
QRegularExpressionMatchIterator i = regexp.globalMatch(st);
while (i.hasNext())
qDebug() << i.next().capturedTexts();
("1,")
(",3,")
(",7,")
(",9")
",2,"
",4,"
",8,"