I am trying to build a QRegEx logic to split number bullet. I tried but couldn't succeed.
sample code:
QString query("1. Ravi Gupta.Pari.Paagal");
QStringList list = query.split(QRegularExpression("\\(.*?\\)"));
qDebug()<<"Output: "<<list;
I am using QRegEx first time. Looking for some help here.
Sample text is --> "1. Ravi Gupta.Pari.Paagal"
Required output should be --> "Ravi Gupta.Pari.Paagal" (without number bullet)
I'm not sure why you're using QString::split
. If the intention is simply to obtain that part of the line after the numbered bullet you could use something like...
QString text("1. Ravi Gupta.Pari.Paagal");
QRegularExpression re("^\\d+\\.\\s+(.*)$");
if (auto match = re.match(text); match.hasMatch()) {
std::cout << "found match [" << match.captured(1) << "]\n";
}
Should give...
found match [Ravi Gupta.Pari.Paagal]