Jump to content

Help with StringRegExp


Recommended Posts

So I'm trying to pull data from a website and I hit a snag. I can't re-call what the parameter is to do a void or and command?


     <img src="

I have this in my website, I want to get what the img src is, so I want only to pull the data that comes after " and before the ending quotation mark.

I thought this would work:

$Image1 = StringRegExp($sSource,'<span>(/r)<img src="(.*?)"', 1)
MsgBox(0, "Test", $Image1[0])

Because using the /r I thought meant it would look for <span>+a line down+<img src=" and then start recording data. But that didn't seem to work.

If anyone could point me in the right direction, that would be great!

--- EDIT ---

After doing some searching... and sadly enough.. realizing I had asked this before (SO sorry! I have a HORRIBLE memory) I found someone helped me but I never looked at it again.. for some reason.

Here is the code he did for me. (Thanks GEOSoft)

$a_Rslt = StringRegExp($sSource, "(?i)(?m:^)s*<imgssrc=.+(http.+.png).*column 1.*-->", 1)
If NOT @Error Then
    MsgBox(0, "Result", "The image you are after should be" & @CRLF & $a_Rslt[0])

And it works like a charm, but I would be happy if someone broke down the StringRegExp for me so I can understand exactly what the params are doing!

Edited by Damein


Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...