note 77775 added to function.preg-replace-callback
| From: | ak at optimumenglish dot com | Date: | Wed, 12 Sep 2007 17:09:54 +0000 |
| Subject: | note 77775 added to function.preg-replace-callback | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-130421@lists.php.net to get a copy of this message | ||
Add this snippet to your callback function to make sure you don't replace HTML code. Useful
when searching / replacing / highlighting HTML. Change 90 to whatever threshold you need if you have
extra extra long tags for some weird reason (lots of inline styles?)
function scanForTags($position, $maintext)
{
for($i = 1;$i < 90; $i++)
{
if($maintext{$position-$i} == "<" || $maintext{$position+$i} == ">")
return true;
if($maintext{$position-$i} == ">" || $maintext{$position+$i} == "<")
return false;
}
return false;
}
----
Server IP: 69.147.83.197
Probable Submitter: 74.103.17.103
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace-callback.php
Edit -- https://master.php.net/note/edit/77775
Del: integrated -- https://master.php.net/note/delete/77775/integrated
Del: useless -- https://master.php.net/note/delete/77775/useless
Del: bad code -- https://master.php.net/note/delete/77775/bad+code
Del: spam -- https://master.php.net/note/delete/77775/spam
Del: non-english -- https://master.php.net/note/delete/77775/non-english
Del: in docs -- https://master.php.net/note/delete/77775/in+docs
Del: other reasons-- https://master.php.net/note/delete/77775
Reject -- https://master.php.net/note/reject/77775
Search -- https://master.php.net/manage/user-notes.php