phpbar.de logo

Mailinglisten-Archive

[php] preg_replace: Zeilenwechsel werden nicht erfasst

[php] preg_replace: Zeilenwechsel werden nicht erfasst

Christoph Jeschke christoph.jeschke at gmail.com
Sam Nov 4 12:10:32 CET 2006


* Simon Bienlein::

Hallo Liste,

> <?php
> $text = "h2. Code-Listings
> 
> [code]pwd[/code]
> 
> [code]simon at debian:~$ pwd
> /home/simon[/code]";
> 
> $text = preg_replace("`\[code\].+\[/code\]`iU", "CODE", $text);
> echo $text;
> ?>

Schau dir den 's'-Modifier (PCRE_DOTALL) mal an:
<http://de.php.net/manual/de/reference.pcre.pattern.modifiers.php>

-- 
  "The sky above the port was the color of
  television, tuned to a dead channel."         o    <http://knurd.de>
     -- William Gibson, Neuromancer,             o   -- A Geek's View
        Chiba City Blues                       ooo

php::bar PHP Wiki   -   Listenarchive