Re: Regex problem
| From: | Ignacio Vazquez-Abrams | Date: | Thu, 30 Nov 2000 19:06:57 +0000 |
| Subject: | Re: Regex problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-28100@lists.php.net to get a copy of this message | ||
On Thu, 30 Nov 2000, Oliver Ertl wrote:
> Hi,
>
> I would like to get the value between tow HTML-Tags (ex <b></b>).
> This is working fine with the code on the end of this mail.
>
> The Problem is when <b> and </b> are not on the same line. For example:
> <b>start tag
> (new line) end tag</b>
>
> How do I need to change the code below to get this working.
>
> <?
>
> $url =
> fopen("http://www.lug-burghausen.org/news/06-00.html");
>
> while (!feof($url)) {
> $line = fgets ($url, 10000);
> $line = eregi_replace("<link(.*)>", "", $line);
>
> if ( eregi("<b>(.*)</b>", $line, $text) );
> echo strip_tags($text[1]), "<br>\n";
> }
> }
>
> ?>
>
> Thanks.
>
> Oliver
>
>
Try:
if ( eregi("<b>((.|\n)*)</b>", $line, $text) );
The period doesn't match newlines.
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>