我究竟做错了什么?我想在 QStringList 中找到与给定 QRegularExpression 匹配的字符串索引。
#include <QCoreApplication>
#include <QStringList>
#include <QRegularExpression>
#include <QDebug>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QStringList list{"bla-bla-bla"};
qDebug() //Prints "true"
<< QRegularExpression("bla-*").match(list[0]).hasMatch();
qDebug() //Prints "-1", but I want it was "0" here
<< list.indexOf(QRegularExpression("bla-*"));
return a.exec();
}