note 71146 added to function.preg-replace

From: Date: Tue, 14 Nov 2006 00:35:31 +0000
Subject: note 71146 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-119697@lists.php.net to get a copy of this message
I've made this from script, presented below: <?php $text = preg_replace('=([^\s]*)(www\.)=', ' http://www.', $text); $text = preg_replace('=([^\s]*)(\w://[www\.]*)([^\s]*)=', '<a href="\\1\\2\\3\\4" target=_blank>\\3\\4</a>', $text); ?> dunno how it works, but it works But if link is long, then I'd like the part ">...</a>" to become shorter - till the end of file name (till "?") guess ---- Server IP: 195.222.164.18 Probable Submitter: 80.70.236.20 ---- Manual Page -- http://www.php.net/manual/en/function.preg-replace.php Edit -- https://master.php.net/note/edit/71146 Del: integrated -- https://master.php.net/note/delete/71146/integrated Del: useless -- https://master.php.net/note/delete/71146/useless Del: bad code -- https://master.php.net/note/delete/71146/bad+code Del: spam -- https://master.php.net/note/delete/71146/spam Del: non-english -- https://master.php.net/note/delete/71146/non-english Del: in docs -- https://master.php.net/note/delete/71146/in+docs Del: other reasons-- https://master.php.net/note/delete/71146 Reject -- https://master.php.net/note/reject/71146 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#119697) next »