Results 1 to 8 of 8

Thread: [2005] Parse URL

  1. #1

    Thread Starter
    Hyperactive Member OMITT3D's Avatar
    Join Date
    Mar 2006
    Posts
    368

    [2005] Parse URL

    Anyone have code to extract a link from a textbox or website or something? I just want to log all links a user types but the problem is it can be in bleh.com format or http://bleh.com format or http://www.bleh.com format and even have /folder1/folder2/file.jpg etc..I am trying to put the domain, the folder, and the file in a listview.

  2. #2
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: [2005] Parse URL

    in order to fully create the correct link, you would have to check each case, if it is not a regular "http://" case with the domain, etc, you would have to build the full string onto the matches using regex and/or string manipulation. I have seen a sample screen scraper project by microsoft that I believe includes this functionality, and the link is at the bottom of the following link: http://www.vbforums.com/showthread.php?t=392874

  3. #3

    Thread Starter
    Hyperactive Member OMITT3D's Avatar
    Join Date
    Mar 2006
    Posts
    368

    Re: [2005] Parse URL

    I got errors compiling it and I really don't understand the code
    Last edited by OMITT3D; Apr 2nd, 2006 at 11:56 PM.

  4. #4
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: [2005] Parse URL

    Well I think that it was originally a 2002 project. You can probably paste the code into whatever version you are working in, and go from there. As far as understanding the code, it is pretty well documented, in fact, its some of the most descriptive code comments I have seen. It even goes so far as to explain each regular expression piece that makes up the whole pattern...

  5. #5

    Thread Starter
    Hyperactive Member OMITT3D's Avatar
    Join Date
    Mar 2006
    Posts
    368

    Re: [2005] Parse URL

    The regex is the part I don't get.

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Parse URL

    Then it's time to do some reading on regex syntax. It can get very complex but. like everything, you should start small and build up. There are plenty of sites on the Net. Here are a couple:

    http://gnosis.cx/publish/programming...pressions.html
    http://www.regular-expressions.info/
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    Hyperactive Member OMITT3D's Avatar
    Join Date
    Mar 2006
    Posts
    368

    Re: [2005] Parse URL

    K I'll read the second link tomorrow thx. If anyone has a code example please post though

  8. #8
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: [2005] Parse URL

    I have posted several regex examples in my time here at good ol' vbforums...

    Click the below link and press "search" in order to find some of them...
    http://www.vbforums.com/search.php?q...0&saveprefs=1&

    The link where I learned most of my regex knowledge...
    http://www.codeproject.com/dotnet/RegexTutorial.asp

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width