Sign in to follow this  
Followers 0
Damein

Little help with StringReg

4 posts in this topic

So someone gave me this to hep me with a script awhile back. Sadly, I just took the code and used it without trying to understand it. Well, that isn't helping me now. I need to do the same thing, but with a different string.

Here is the code

StringRegExp($sSource, "(?i)<img\ssrc=.+(http.+\.png).*column 1.*-->", 1)

Now its pulling data from this:

http://www.weather.com/weather/today/Jeffersonville+IN+47130

So what I want to know is, what do all of the arguments mean in this StringRegExp? Because I tried using them myself, but I couldn't get it to work with the other webpage.

I am trying to get the times from this website

http://www.weather.com/weather/hourbyhour/graph/47130

Specifically

<div class="hbhWxHour" id="hbhWxHour0">
       
        <div class="hbhWxDate"><div>Mon<br>Apr 23</div></div>
        
        <div class="hbhWxTime"><div>4 pm</div></div>
        <div class="hbhWxImg"><div style="cursor:pointer;" onclick="gotoTableView('/weather/hourbyhour/47130','16')"><img src="http://i.imwx.com/web/common/wxicons/45/24.gif" alt="" width="45" height="45" border="0"></div></div>
        <div class="hbhWxTemp"><div>61.0&deg; </div></div>
        <div class="hbhWxPrecip"><div><span>Precip:</span><br>10%</div></div>
       </div><!-- hbhWxHour -->

I am heading out the door now, so I will post more info later if need be. Pretty much I need to be able to grab the "4 pm" from that one, and then be able to do it for all the other times as well. But mine for some reason just grabs the "11 pm", which is:

<div class="hbhWxHour" id="hbhWxHour7">
        
        
         <div class="hbhWxDate hbhWxDateSpacer"><div>&nbsp;<br>&nbsp;</div></div>
         
         <div class="hbhWxTime"><div>11 pm</div></div>
         <div class="hbhWxImg"><div style="cursor:pointer;" onclick="gotoTableView('/weather/hourbyhour/47130','23',',')"><img src="http://i.imwx.com/web/common/wxicons/45/33.gif" alt="" width="45" height="45" border="0"></div></div>
         <div class="hbhWxTemp"><div>48.0&deg; </div></div>
         <div class="hbhWxPrecip"><div><span>Precip:</span><br>0%</div></div>
        </div><!-- hbhWxHour -->

For some reason.

Anyways, thanks in advance!


MCR.jpg?t=1286371579

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

Share this post


Link to post
Share on other sites



Just as a little FYI. I don't want someone to code this for me exactly. I just want them to break each argument down for me so I can better understand whats going on ;)


MCR.jpg?t=1286371579

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

Share this post


Link to post
Share on other sites

Damein,

I do not think you are going to have much luck asking for a personal course in SRE parsing. :)

The best way ahead is to start learning about SREs yourself and then posing specific questions when you come across problems applying one in your code. I always recommend this site as a good point to start learning about SREs - although jchd has a soft spot for this one. :D

Good luck. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Alright, I made a round-a-bout way to do this myself, but I had to split the source two ways.

$Time1Start = StringRegExp($sSource, '(?s)id="hbhWxHour0">(.+?)<!--', 1)
    $Time1 = StringRegExp($Time1Start[0], '(?s)<div class="hbhWxTime"><div>(.+?)</div>', 1)

But thanks, I'll look into that ;)


MCR.jpg?t=1286371579

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0