1

HTMLからすべての参照リンクを取得する正規表現を作成します

QRegExp bodylinksrx("(<a\\s+href\\s*=\\s*[^<>]*\\s*>[^<>]*</a>)");
QStringList bodylinks;
pos = 0;
while ((pos = bodylinksrx.indexIn(htmlcode, pos)) != -1)
{
    bodylinks << bodylinksrx.cap(1);
    pos += bodylinksrx.matchedLength();
}

結果としてリストを受け取ります:

("<a href="http://somehref" class="someclass">href text...</a>", "<a href="http://somehref" class="someclass">href text...</a>", ......")

しかし、私はリストを受け取る必要があります"http://somehref" "href text..." "http://somehref" "href text..." ....

4

1 に答える 1