note 109608 added to function.preg-replace

From: Date: Wed, 01 Aug 2012 23:24:17 +0000
Subject: note 109608 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-189565@lists.php.net to get a copy of this message
preg seems not greedy by default preg_replace('/&lt;code&gt;(.*?)&lt;\/code&gt;/is', "<code class='prettyprint'>$1</code>", $preview); if you have: "a bunch of stuff <code>this that</code> and more stuff <code>with a second code block</code> then extra at the end" and do a htmlentities() on the quoted string, then the above will will replace every instance of the stuff between the CODE tags with the modified code tag ---- Server IP: 64.71.164.2 Probable Submitter: 67.161.99.149 ---- Manual Page -- http://www.php.net/manual/en/function.preg-replace.php Edit -- https://master.php.net/note/edit/109608 Del: integrated -- https://master.php.net/note/delete/109608/integrated Del: useless -- https://master.php.net/note/delete/109608/useless Del: bad code -- https://master.php.net/note/delete/109608/bad+code Del: spam -- https://master.php.net/note/delete/109608/spam Del: non-english -- https://master.php.net/note/delete/109608/non-english Del: in docs -- https://master.php.net/note/delete/109608/in+docs Del: other reasons-- https://master.php.net/note/delete/109608 Reject -- https://master.php.net/note/reject/109608 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#189565) next »