|
-
Apr 2nd, 2006, 09:56 PM
#1
Thread Starter
Hyperactive Member
[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.
-
Apr 2nd, 2006, 10:47 PM
#2
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
-
Apr 2nd, 2006, 11:45 PM
#3
Thread Starter
Hyperactive Member
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.
-
Apr 3rd, 2006, 12:29 AM
#4
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...
-
Apr 3rd, 2006, 01:51 AM
#5
Thread Starter
Hyperactive Member
Re: [2005] Parse URL
The regex is the part I don't get.
-
Apr 3rd, 2006, 01:56 AM
#6
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/
-
Apr 3rd, 2006, 02:11 AM
#7
Thread Starter
Hyperactive Member
Re: [2005] Parse URL
K I'll read the second link tomorrow thx. If anyone has a code example please post though
-
Apr 3rd, 2006, 02:48 AM
#8
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|