-
[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.
-
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
-
Re: [2005] Parse URL
I got errors compiling it :rolleyes: and I really don't understand the code :(
-
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...
-
Re: [2005] Parse URL
The regex is the part I don't get.
-
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/
-
Re: [2005] Parse URL
K I'll read the second link tomorrow thx. If anyone has a code example please post though :)
-
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