Help using httputils

MrDavis

New Member
Licensed User
Longtime User
Could someone help explain the following line of code. This code is from the flickr example... I pretty sure I have this right -- pattern and class are string variables...and QUOTE = char(34) which is quote -- thus:

class= <td class="Photo"> (this makes sense)

I have looked at the webpage (Flickr: Explore interesting photos from the last 7 days in FlickrLand...) page source and just do not get replacing q with quotes in the pattern string...???...(i.e. String.Replace("q",QUOTE))


Dim pattern, class As String
class = "<td class=" & QUOTE & "Photo" & QUOTE & ">"
pattern = "img src=\q([^q]+)\q".Replace("q", QUOTE)

...sorry for posting this in the wrong place...
 
Last edited:

MrDavis

New Member
Licensed User
Longtime User
Not meaning to be dense here - but what is the resulting string pattern used for? I am just having a problem with where we are matching pattern in String line (5th line from bottom) BTW - I get your explanation but do not understand where the resulting string applies... img src=\"([^"....


B4X:
pattern = "img src=\q([^q]+)\q".Replace("q", QUOTE)
   Dim links As List
   links.Initialize
   Dim line As String
   line = TextReader1.ReadLine
   Do While line <> Null
      If line.IndexOf(class) > -1 Then
         Dim link As String
         Dim m As Matcher
         m = Regex.Matcher(pattern, line)
         If m.Find Then
            links.Add(m.Group(1)) 'add the image link
         End If
      End If
 
Upvote 0
Top