Hi, I’m using FeedX for reading comic strip feeds and send the image from the feed to a javascript that use .innerHTML to swap images in a div.
From a certain type of feeds the image comes packed inside HTML, which I can’t send directly to the javascript, so I need to parse it and get the content of the img src attribute only.
Specifically, I’ll get the image to a FeedX placeholder ’[+DESCRIPTION+]’ typically containing a string like this:
<img src="http://spray.nettavisen.no/shared/nemi/img/04.10.06.gif" border="0" />
and need to parse it so I can send only this to the javascript:
http://spray.nettavisen.no/shared/nemi/img/04.10.06.gif
To do this, I’ve installed PHx and made a snippet ’phx:imgsrc’ like this:
<?php
$pattern = '\"(.+?)\"';
preg_match($pattern,$output,$matches);
return $matches[0];
?>
I’ve tested the regexp in Komodo Rx Toolkit and it matches. I’ve also tested PHx and it works correctly.
However when I try to use this modifier on the placeholder like this: ’[+DESCRIPTION:imgsrc+]’ I get this error:
PHP error debug
Error: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash
Error type/ Nr.: Warning - 2
I’ve looked at a lot of online examples, and all uses backslashes to escape the double quote. I’ve tried a zillion different regular expressions but not managed to make a correct one!
How can I write a PHx modifier that will do what I want?