Hi
I am looking for some help regarding using an IF statement. I am currently using the webparser to pull football fixtures from a site to display in a box. I have finally got the first final version running well and out on Deviantart. I am now being asked by downloaders to add a link to watch the game live if it is actually a live televised game.
The problem I am having is in order to do this as far as I can see I would have to include this in the RegExp and also include an IF statement to say if this appears use it if it isn't there don't include rather than give any errors.
If anyone could help me with this it would be appreciated
If you need anymore information I will try to help
Thanks in advance
It is currently April 27th, 2024, 3:34 pm
Help with RegExp, Webparser and an IF statement
-
- Posts: 9
- Joined: September 17th, 2012, 10:39 am
-
- Developer
- Posts: 1721
- Joined: July 25th, 2009, 4:47 am
Re: Help with RegExp, Webparser and an IF statement
You may be able to use lookahead assertions for this, depending on the page layout. A lookahead assertion looks something like this:
In this example, if the Watch live string is found, the pattern will look for and return the link address. If Watch live[snippet] is not found, this part of the pattern is skipped, and the string index will be blank.
Code: Select all
RegExp=(?siU)(?(?=.*Watch live).*<a href="(.*)">)
-
- Posts: 9
- Joined: September 17th, 2012, 10:39 am
Re: Help with RegExp, Webparser and an IF statement
Thanks for that, I think that will be useful.
I have tried to play around with my coding and managed to isolate the text with RegExp which was simple enough however the "Watch Live" text is showing even for games that aren't televised so my RegExp must be wrong.
The RegExp I am using at the moment is
This returns the "Watch Live" text regardless. If you look http://www1.skysports.com/football/teams/manchesterunited/fixtures you will see the next 2 games aren't live but the 3rd one is so I need to work out how to get it to work correctly
I have tried to play around with my coding and managed to isolate the text with RegExp which was simple enough however the "Watch Live" text is showing even for games that aren't televised so my RegExp must be wrong.
The RegExp I am using at the moment is
Code: Select all
RegExp="(?siU)<h4 class="fix-head-t2">(.*)</h4>.*<div class="score-sub">(.*)</div>.*<div class="score-comp">.*(\S.*)\s</div>.*<div class="score-side score-side1">.*(\S.*)\s</div>.*<div class="score-side score-side2">.*(\S.*)\s</div>.*<li class="score-tv"><img src="http://e2.365dm.com/tvlogos/pixel/ss1hd.gif" title="(.*)"></li>"
-
- Posts: 9
- Joined: September 17th, 2012, 10:39 am
Re: Help with RegExp, Webparser and an IF statement
OK so I am not getting much further than I have already got.
I am having trouble working out the logic behind what I need.
As you can see from the link I have provided there is a full list of fixtures till the end of the season. some are televised some aren't but all follow the same format, that is unless it is being shown on TV.
Can anyone give me a little more help on what sort of coding to use. I know what I want I just don't know how to go about getting it and can't seem to find anything that is similar to this in any way.
Your help would be appreciated
I am having trouble working out the logic behind what I need.
As you can see from the link I have provided there is a full list of fixtures till the end of the season. some are televised some aren't but all follow the same format, that is unless it is being shown on TV.
Can anyone give me a little more help on what sort of coding to use. I know what I want I just don't know how to go about getting it and can't seem to find anything that is similar to this in any way.
Your help would be appreciated