From: "Dillon, John" <[EMAIL PROTECTED]>

> strip_tags() is used to remove HTML tags, eg for showing text on the
browser
> and then sending it by plain text email or storing in the db.  As a matter
> of interest, how is this done using ereg_replace.  I thought this would
work
> ^<.*>$, that is being with < and any number of single characters ending
with
> >.  Didn't seem to work - why?

Because you have ^ and $ (beginning of string and end of string), you're
saying the entire string must be between < and > in order for a match to
occur.

Take them out and make sure you're not being "greedy", i.e. "this <tag> and
that <tag> are left" being reduced to "this  are left".

ereg_replace('<[^>]*>','',$string);

or

preg_replace('/<[^>]*>/','',$string);

should work.

---John Holmes...

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to