problem with this regex to remove img tag...
| From: | Ryan A | Date: | Sun, 16 Mar 2008 20:43:28 +0000 |
| Subject: | problem with this regex to remove img tag... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-271667@lists.php.net to get a copy of this message | ||
Hey All,
After searching I found this regex to remove img tags from a post, but running it is giving me an
error, being a total noob with regex i have no idea what the heck is wrong.... heres the whole
script as its tiny:
<?php
$html = " hello ".'<img src="/articles-blog/imgs/paul-fat.jpg"
alt="" width="272" height="289" align="left">'.
" Paul! ";
$html =
preg_replace('</?img((\s+\w+(\s*=\s*(?:".*?"|\'.*?\'|[^\'">\s]+))?)+\s*|\s*)/?>',
'', $html);
echo $html;
?>
Any help appreciated.
TIA,
Ryan
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs