note 41631 added to function.preg-replace

From: Date: Sat, 17 Apr 2004 14:22:07 +0000
Subject: note 41631 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-68250@lists.php.net to get a copy of this message
This took a few hours of my life. If you want to replace a string in a chunk of text WITHOUT replacing it in the html tags use the following: (i used this for a search engine to search a news database which includes html) preg_replace("'(?!<.*?)$string(?![^<>]*?>)'si", "REPLACED", $chunk); ---- Manual Page -- http://www.php.net/manual/en/function.preg-replace.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+41631 Delete -- http://master.php.net/manage/user-notes.php?action=delete+41631&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+41631&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#68250) next »