Welcome to Dream.In.Code
Getting VB.NET Help is Easy!

Join 131,715 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 2,395 people online right now. Registration is fast and FREE... Join Now!




Problem with extracting jpg from url

 
Reply to this topicStart new topic

Problem with extracting jpg from url

Damage
post 6 Oct, 2008 - 03:50 AM
Post #1


D.I.C Addict

Group Icon
Joined: 5 Jun, 2008
Posts: 728



Thanked 7 times

Dream Kudos: 75
My Contributions


i'm trying to retrieve all jpgs from a given url but my function isn't returning anything. I have no clue when it comes to regular expressions this is something i got from a site I googled. Any advice would be appreciated

CODE
  
Try
            
            Dim picList As New ArrayList()

            
            
            Dim regString As String = "goodjpg=(/sr\.pos/.test(s)==false && /\.jpg$/i.test(s))"
            Dim reg As New Regex(pattern, RegexOptions.IgnoreCase Or RegexOptions.ExplicitCapture)

            
            Dim matches As MatchCollection = reg.Matches(str)

            
            For Each match As Match In matches
            
            
                    picList.Add(match.tostring)
                Next
                        
            Return (picList)
User is offlineProfile CardPM

Go to the top of the page

Damage
post 6 Oct, 2008 - 04:50 PM
Post #2


D.I.C Addict

Group Icon
Joined: 5 Jun, 2008
Posts: 728



Thanked 7 times

Dream Kudos: 75
My Contributions


or am i just being exceedingly thick? now that i look at it, i'm passing the url as a string(str) and comparing that to the regex. How is it supposed to figure out that the string is a url. but how do you pass a URL as an argument?

by the way i'm now trying
CODE

http://img.4chan.org/b/src/*.jpg

is that any better?
User is offlineProfile CardPM

Go to the top of the page

Damage
post 7 Oct, 2008 - 01:42 AM
Post #3


D.I.C Addict

Group Icon
Joined: 5 Jun, 2008
Posts: 728



Thanked 7 times

Dream Kudos: 75
My Contributions


is it worth learning Perl to do this?


This post has been edited by Damage: 7 Oct, 2008 - 01:46 AM
User is offlineProfile CardPM

Go to the top of the page

Jayman
post 7 Oct, 2008 - 08:24 AM
Post #4


Student of Life

Group Icon
Joined: 26 Dec, 2005
Posts: 6,827



Thanked 38 times

Dream Kudos: 500

Expert In: C#, VB.NET, Java

My Contributions


Are you scraping the HTML to get the JPEG's?

Is it being pulled directly from the URL address?

What is stored in "str"?

Need more details in order to provide a solution to your issue.

User is online!Profile CardPM

Go to the top of the page

Damage
post 11 Oct, 2008 - 01:38 PM
Post #5


D.I.C Addict

Group Icon
Joined: 5 Jun, 2008
Posts: 728



Thanked 7 times

Dream Kudos: 75
My Contributions


just wanted to say thanks for the assistance, but I've started over and am now using strings instead of regex. less flexibility i know, but i really have no clue what I'm doing with regular expressions at the moment
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/20/08 09:51AM

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month