Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: regex help please Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
theowl
Groupie
Groupie
Avatar

Joined: February 24 2006
Location: United States
Online Status: Offline
Posts: 59
Posted: June 13 2006 at 20:07 | IP Logged Quote theowl

I got a simple RSS parse working using ph_regex

insert into macroheader values ('RSS-GET','GRAB AND PARSE RSS FEEDS',0,0,1);
insert into macrodetail values ('RSS-GET',2,15,'[GLOBAL1] ',NULL,'ph_geturl("http://blog.washingtonpost.com/securityfi x/index.xml")',0,'');
insert into macrodetail values ('RSS-GET',3,15,'[GLOBAL1]',NULL,'ph_replaceallregex ("&....;","----", ph_getvar_s(3,1),2)',0,'');
insert into macrodetail values ('RSS-GET',4,15,'[LOCAL2]',NULL,'ph_regexdiff ( "<title>", "</title>", ph_getvar_s(3,1),1,2) ',0,'');
insert into macrodetail values ('RSS-GET',5,9,'',NULL,'"Site: [LOCAL2]"',0,'');
insert into macrodetail values ('RSS-GET',6,15,'[LOCAL3]',NULL,'ph_regexdiff ( "<item>~255<item>", "</item>~255</item>", ph_getvar_s(3,1),1,2) ',0,'');
insert into macrodetail values ('RSS-GET',7,15,'[LOCAL4]',NULL,'ph_regexdiff ( "<title>", "</title>", ph_getvar_s(1,3),1,2) ',0,'');
insert into macrodetail values ('RSS-GET',8,15,'[LOCAL5]',NULL,'ph_regexdiff ( "<Description>", "</Description>", ph_getvar_s(1,3),1,2)',0,'');
insert into macrodetail values ('RSS-GET',9,15,'[LOCAL5]',NULL,'ph_replaceallregex ( "\&+\;", "", ph_getvar_s(1,5),2)',0,'');
insert into macrodetail values ('RSS-GET',10,16,'',NULL,'if(ph_getvar_s(2,1) = "",999,1)',1,'');
insert into macrodetail values ('RSS-GET',11,9,'',NULL,'"Title: [LOCAL4]"',0,'');
insert into macrodetail values ('RSS-GET',12,9,'',NULL,'"Description: [LOCAL5]"',0,'');
insert into macrodetail values ('RSS-GET',13,16,'',NULL,'-5',1,'');

I used [GLOBAL1] so the page would stay stored while I tested the ph_replaceallregex function. The issue I'm having is getting the regex to match more than one <item> on the page. Using <item>, it will match the first one, and if I use <item>~255<item> it will match the second. Do I really have to keep doing the 255 routine to go further down the page or does this function store the last search position somewhere so I can start from where it left off?

Anyone?
Back to Top View theowl's Profile Search for other posts by theowl
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: June 13 2006 at 20:29 | IP Logged Quote TonyNo

Take a look at my Weather Warnings macro for how to do this. It also parses <item> tags.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
theowl
Groupie
Groupie
Avatar

Joined: February 24 2006
Location: United States
Online Status: Offline
Posts: 59
Posted: June 15 2006 at 14:58 | IP Logged Quote theowl

Tony,

I imported that and it worked great. However, it's above my PH knowledge. From what I can decode, it looks like your doing a multi-search...but that's as far as I could factor.

I did find an activeX helper that gives VBscript the ability to handle all versions of RSS (I hope). I'm working on a little script using that.

So far, I can just feed the script a URL, channel to access, and item I want. Once I get the error checking correct and make the PH modification... PH should be able to easily handle everything else.
Back to Top View theowl's Profile Search for other posts by theowl
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: June 16 2006 at 14:37 | IP Logged Quote dhoward

Owl,

Keep us posted on your progress. We don't have too many people exercising the VBScript capabilities of PowerHome so would love to see what you're doing.

Also, the next beta will include some additional regex functions to hopefully make searches easier.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
theowl
Groupie
Groupie
Avatar

Joined: February 24 2006
Location: United States
Online Status: Offline
Posts: 59
Posted: June 17 2006 at 15:30 | IP Logged Quote theowl

Will do

Most of the script is just error checking stuff, the actual action code is quite small.

It's nice to have the VBscript ability in PH because I can write and debug those type of scripts at work if I'm bored. Then e-mail them to the automation system, drop in place, and away it goes.
Back to Top View theowl's Profile Search for other posts by theowl
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum