preg_match("/.*<b[^>]+>(.*)<font face=\"Verdana\" size=\"3\">.*/", 
$contents,$story);
echo $story[1];

preg_match always return a array. The first element ($array[0])contains your 
complete regexp. The next ($array[1])one the first match between () etc.
Don't use ! but /




Op zondag 18 augustus 2002 01:27, schreef Jason Soza:
> I seriously need some help trying to make a match here. Obligatory
> disclaimer: yes, I've searched google.com, I've read the PHP manual section
> on preg_match(), and I've sat here for 3 hours trying to resolve this on my
> own. :) Any help would be great:
>
> I need to match everything between:
>
> <b>$headline
>
> Where $headline is a variable that will be filled out of a foreach() loop.
> The pattern should return everything until it hits:
>
> <font face="Verdana" size="3">
>
> The text file this is taken out of looks like:
>
> <font face="Verdana" size="3"><b>Headline here</b></font><p>
>
> News story, blah, blah, blah...
>
> <font face="Verdana" size="3"><b>Another headline</b></font><p>
>
> More news, blah, blah...
>
> ...
>
> The contents of the text file echo correctly before the preg_match, but the
> preg_match I've tried:
>
> preg_match("!<b[^>]+>(.*)<font face=\"Verdana\" size=\"3\">!", $contents,
> $story);
>
> Returns array(), so no matches are made. Any suggestions?
>
> TIA,
>
> Jason Soza

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to