Results 1 to 2 of 2

Thread: how can get all links with QT from a web page?

  1. #1
    Join Date
    Aug 2009
    Posts
    38
    Thanks
    3

    Default how can get all links with QT from a web page?

    Hi,

    I have the html source of a URL in a QString. How could I get all the links with QRegExp?

    Many thanks and sorry for my english!

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: how can get all links with QT from a web page?

    Start with the documentation of QRegExp
    Qt Code:
    1. QRegExp rx("(\\d+)");
    2. QString str = "Offsets: 12 14 99 231 7";
    3. int pos = 0;
    4.  
    5. while ((pos = rx.indexIn(str, pos)) != -1) {
    6. list << rx.cap(1);
    7. pos += rx.matchedLength();
    8. }
    9. // list: ["12", "14", "99", "231", "7"]
    To copy to clipboard, switch view to plain text mode 
    And then simply write a expression which fits your needs. It isn't so complicated... And if you don't know use google with "regular expressions link href"!

Similar Threads

  1. how can get all links with QT from a web page?
    By ChineseAlexander in forum Qt Programming
    Replies: 4
    Last Post: 17th April 2009, 06:41
  2. Best way to open a Qt window from web page?
    By montylee in forum Qt Programming
    Replies: 9
    Last Post: 19th January 2009, 08:04
  3. QTabWidget remove a page at the page's request
    By thomaspu in forum Qt Programming
    Replies: 2
    Last Post: 29th December 2007, 20:45
  4. page faults
    By moowy in forum General Programming
    Replies: 2
    Last Post: 20th January 2007, 14:13
  5. QWidget display on 2 stack widget page
    By spawnwj in forum Qt Programming
    Replies: 3
    Last Post: 4th September 2006, 12:07

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.