Qt 6.11 is out! See what's new in the release
blog
Get classes QStringList from Html source code?
General and Desktop
1
Posts
1
Posters
995
Views
1
Watching
-
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">
</body>@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.