[thelist] [PHP] Ignoring an IMG tag within a string

Courtenay court3nay at gmail.com
Mon Oct 25 01:31:23 CDT 2004


:)  Regular expressions are like crack.. once you get into 'em, you
think you can rule the world!  www.regular-expressions.info  is your
guide here.

There may actually be an appropriate php tag for what you want to do.
however, off the top of my head.. here goes

you want replace all instances of <img ......> with an empty string.
use

ereg_replace("<img[^>]*>", "", your_string)

basically it finds an <img tag, then looks for anything up til the end
of the tag, then replaces that with an empty string.

then you can print your modified string.

> > Do you know much about regular expressions?
> 
> I have seen them, and tried to use them with ASP before, but I can't say
> I know what I'm doing, and wouldn't have a clue how to use them to get
> the result i'm after.


More information about the thelist mailing list