Huhu e7
mit look ahead geht es eigentlich ganz einfach, auch wenn
das keine Performance Wunder vollbringen wird.
$regexp = "/(&)(?![^>]+(<|$))/i";
Hier mal ein vollständiges Beispiel
<?php
$test = <<<EOT
— <a href="http://www.0815.net?a=12&b=12&c=13">Test GmbH & Co KG </a>
& bei Bildern
<img src="thumbnail.php?x=12&y=400">
& wieso soll das nicht gehen?
EOT;
$regexp = "/(&)(?![^>]+(<|$))/i";
$new = preg_replace ($regexp, '&', $test);
echo $new;
?>
Viele Grüße
lulu
--
bythewaythewebsuxgoofflineandenjoytheday
bythewaythewebsuxgoofflineandenjoytheday