I must be dumb because I still can't get it to work.

Using the following instead of my previous preg_match_all statement:
preg_match_all("|<font face=\"Verdana\" size=\"3\"><b>(.*)</b></font>|i",
$contents, $out);

Gives me only the -last- 3 headlines on
http://www.kinyradio.com/juneaunews/latest_juneau_news.html. I've looked at
the source and there are indeed more matching tags than are being returned.
I've tried placing "r+" in my fopen() statement to put the pointer at the
beginning of the file, but no luck there. I've also tried a bigger filesize
constant in fread(), still nothing.

Actually, I just noticed what the difference is with those last three -
their lines don't break in the source. The other lines have breaks, so the
</b></font> land on the following line. Is there anything I can do to have
preg_match_all 'connect' the lines?

Any help would be great. Thanks!

Jason Soza

-----Original Message-----
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 1:20 AM
Subject: Re: [PHP] Re: Using fopen()/fread()/fscanf()

On Tuesday 23 July 2002 15:38, Jason Soza wrote:
> Alright, I see that this is probably the way to go, but I'm dying here. I
> have this:
>       $filename =
> fopen("http://www.kinyradio.com/juneaunews/latest_juneau_news.html";, "r");
>       $contents = fread($filename, 1000000);
>       preg_match_all("|<font face=\"Verdana\" size=\"3\"><b>+[-a-zA-Z0-9,.
> ]+|i", $contents, $out);
>       print_r($out);

Assuming that the <font> and <b> tags are closed and you want everything in
between then try this:

  preg_match_all("|<font face=\"Verdana\" size=\"3\"><b>(.*)</b></font>|i",
$contents, $out);

> The manual entries for preg_match and preg_match_all pretty much assume
> have a working knowledge of reg expressions, which I don't, and a google
> search turned up a bunch of pages, none of which I could understand enough
> to be of help. So, any pointers would be appreciated. Thanks!

You want to read up on "Pattern Modifiers" and "Pattern Syntax", that's
all the regex black magic is explained.

Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

He's dead, Jim.
                -- McCoy, "The Devil in the Dark", stardate 3196.1

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

Reply via email to