note 46184 deleted from function.preg-replace by tularis
| From: | tularis@php.net | Date: | Sun, 18 Jun 2006 13:20:31 +0000 |
| Subject: | note 46184 deleted from function.preg-replace by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-114330@lists.php.net to get a copy of this message | ||
Note Submitter: Marko Zarkovic, Ottawa
----
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.