note 46184 added to function.preg-replace

From: Date: Fri, 01 Oct 2004 16:05:58 +0000
Subject: note 46184 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-77688@lists.php.net to get a copy of this message
I spent a few hours trying to determine why I couldn't find a substring to replace in an HTML fragment. $searchstr = "/\"" . $linehash['item'] . "\"/"; $replacestr = "\"" . $linehash['item'] . "\" SELECTED"; $regexval = preg_replace($searchstr, $replacestr, $htmlfragment); $linehash['item'] was a value read from a file. I realized that I had to TRIM() invisibles from $linehash['item']. See the TRIM function for more information. ---- Manual Page -- http://www.php.net/manual/en/function.preg-replace.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46184 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46184&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+46184&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#77688) next »