Frage
Jetzt habe ich ein Problem mit Eregi_Replace:
ich habe das
$subject = "This is for @codeworxx - you have to try first!";
$text = eregi_replace('(((@))[-a-zA-Z0-9]+)','<a href="http://www.google.de/\\1">\\1</a>', $subject);
echo $text;
Alles funktioniert gut, aber die
<a href="http://www.google.com/@codeworxx">@codeworxx</a>
Aber ich will das:
<a href="http://www.google.com/codeworxx">codeworxx</a>
wie macht man?
Danke, Sascha
Lösung
<?php
$subject = "This is for @codeworxx - you have to try first!";
$text = eregi_replace('@([-a-zA-Z0-9]+)','<a href="http://www.google.de/\\1">\\1</a>', $subject);
echo $text;
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow