Mailinglisten-Archive |
Moin!
Am 11.10.2005 um 08:49 schrieb thomas.hausheer at bluewin.ch:
> warum geht $1 nicht?
geht doch! ;-)
> preg_replace('/http?:\/\/([^ $])+/i', '<a href=">$1</a>',$a)
>
> Das Regex funktioniert, ahref wird geschrieben. Doch der
> 'Orginal'eintrag
> kommt nicht.
Ich rate mal $1 soll von "http://www.phpbar.de" nur noch
"www.phpbar.de" enthalten.
Dann versuch es mal mit
preg_replace('/http?:\/\/(.*)/i', '<a href="">$1</a>',$a);
Das ist vermutlich noch nicht ganz was Du haben möchtest und auch
noch nicht besonders sinnig ("http?") aber ein Anfang... Aber
Achtung: Grep Patterns sind auch eine Frage der Sorgfalt!
cheers
Philipp
php::bar PHP Wiki - Listenarchive