note 90661 added to function.preg-match
| From: | daniel dot chcouri at gmail dot com | Date: | Sun, 03 May 2009 14:01:13 +0000 |
| Subject: | note 90661 added to function.preg-match | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-154158@lists.php.net to get a copy of this message | ||
Little fix to the last function:
function removeHtmlTagsWithExceptions($html, $exceptions = null){
if(is_array($exceptions) && !empty($exceptions))
{
foreach($exceptions as $exception)
{
$openTagPattern = '/<(' . $exception . ')(\s.*?)?>/msi';
$closeTagPattern = '/<\/(' . $exception . ')>/msi';
$html = preg_replace(
array($openTagPattern, $closeTagPattern),
array('||l|\1\2|r||', '||l|/\1|r||'),
$html
);
}
}
$html = preg_replace('/<.*?>/msi', '', $html);
if(is_array($exceptions))
{
$html = str_replace('||l|', '<', $html);
$html = str_replace('|r||', '>', $html);
}
return $html;
}
----
Server IP: 82.80.248.162
Probable Submitter: 217.132.132.64
----
Manual Page -- http://www.php.net/manual/en/function.preg-match.php
Edit -- https://master.php.net/note/edit/90661
Del: integrated -- https://master.php.net/note/delete/90661/integrated
Del: useless -- https://master.php.net/note/delete/90661/useless
Del: bad code -- https://master.php.net/note/delete/90661/bad+code
Del: spam -- https://master.php.net/note/delete/90661/spam
Del: non-english -- https://master.php.net/note/delete/90661/non-english
Del: in docs -- https://master.php.net/note/delete/90661/in+docs
Del: other reasons-- https://master.php.net/note/delete/90661
Reject -- https://master.php.net/note/reject/90661
Search -- https://master.php.net/manage/user-notes.php