note 47419 added to function.preg-replace

From: Date: Mon, 15 Nov 2004 23:58:42 +0000
Subject: note 47419 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-80569@lists.php.net to get a copy of this message
I believe Paul's might have made a typo: $text = preg_replace("/(http:\/\/(.*))[\s]*/", "<a href=\\1>\\1</a> ", $text); remembers the [\s] : meaning any whitespace character, while he probably meant [\S] which is any non-whitespace character. The corrected regex would be: $text = preg_replace("/(http:\/\/(.*))[\S]*/", "<a href=\\1>\\1</a> ", $text); ---- Manual Page -- http://www.php.net/manual/en/function.preg-replace.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+47419 Delete -- http://master.php.net/manage/user-notes.php?action=delete+47419&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47419&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47419&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47419&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47419&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47419&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+47419&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#80569) next »