note 84202 added to function.ereg-replace

From: Date: Thu, 03 Jul 2008 07:52:47 +0000
Subject: note 84202 added to function.ereg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-141103@lists.php.net to get a copy of this message
Just a quick addition to the last post - modifying the regular expression for the www clause to include a newline at the begining will allow it to catch URLs that are the first in a line but not the first in a string. The previous version would only catch them if a space preceded the value... // match www.something $text = ereg_replace("(^| |\n)(www([.]?[a-zA-Z0-9_/-])*)", "\\1<a href=\"http://\\2\">\\2</a>", $text); ---- Server IP: 208.69.120.35 Probable Submitter: 76.104.180.221 ---- Manual Page -- http://www.php.net/manual/en/function.ereg-replace.php Edit -- https://master.php.net/note/edit/84202 Del: integrated -- https://master.php.net/note/delete/84202/integrated Del: useless -- https://master.php.net/note/delete/84202/useless Del: bad code -- https://master.php.net/note/delete/84202/bad+code Del: spam -- https://master.php.net/note/delete/84202/spam Del: non-english -- https://master.php.net/note/delete/84202/non-english Del: in docs -- https://master.php.net/note/delete/84202/in+docs Del: other reasons-- https://master.php.net/note/delete/84202 Reject -- https://master.php.net/note/reject/84202 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#141103) next »