phpbar.de logo

Mailinglisten-Archive

[php] von(<title>) - bis(</title>) suchen

[php] von(<title>) - bis(</title>) suchen

Ulf Wendel ulf_(at)_redsys.de
Sun, 04 Jun 2000 11:34:24 +0200


Daniel Beulshausen wrote:

> http://php-center.de/de-html-manual/ref.pcre.html
> 
> <?
> 
> $string = "<html><head><title>Titel des
> Dokumentes</title></head><body>...";
> 
> preg_match("/<title>(.*)<\/title>/",$string, $regs);
> 
> print $regs[1];
> 
> ?>

<?php
 $html = "<title>1</title></title>";
 preg_match("/<title>(.*)<\/title>/U", $html, $regs);

 reset($regs);
 while (list($k, $v)=each($regs)) 
  echo "$k => $v<br>";
?>

PCRE_UNGREEDY Modifier nicht vergessen. 

Ulf


php::bar PHP Wiki   -   Listenarchive