note 34340 added to function.ereg-replace
| From: | devnull at hotmail dot com | Date: | Thu, 24 Jul 2003 11:40:08 +0000 |
| Subject: | note 34340 added to function.ereg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-52548@lists.php.net to get a copy of this message | ||
A couple of handy little snippets I've found/found and dabbled with for my own uses :-
1/ Remove all image tags from HTML (i.e. if you are pulling data from another site, and wish to
re-display it minus images) :-
$data=preg_replace("'<IMG[^>]*?>.*?>'si", "", $data);
2/ Remove all links BUT leave the text within the link intact (i.e. if you want to still display a
menu's name but not retain the actual link) :-
$data=preg_replace("'<A HREF[^>]*?>'si", "",$data);
$data=str_replace("</A>","",$data);
Presto!
Alex.
----
Manual Page -- http://www.php.net/manual/en/function.ereg-replace.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34340
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34340&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34340&report=yes