Get classes QStringList from Html source code?

  • Hello everybody, I want to extract the classes from an Html source code and get a QStringList. The way that I could figure out was the next


        QString content = ui->webView->page()->mainFrame()->toHtml();
        qDebug()<<"Content: \n"<<content.split(QRegExp("type=\"[\\w\\d\\s\\.:;/=-]+\""),QString::SkipEmptyParts);@

    But this Returns a list of everything that is diferent from the regular expresion.

    For example if the webview contains:

    @<body class="class1">

    the code return a list with two elements
    @"<body " and ">\n</body>"@

    That means that I need to make something to negate the Regular Expresion or use another method instead split, like search or find. However, QString class don't has any method to search and return a QStringList.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.