Jump to content


Photo

strip HTML tags but leave <em> and <i>


  • Please log in to reply
3 replies to this topic

#1 tvdhoff

tvdhoff
  • Members
  • PipPip
  • Member
  • 16 posts

Posted 16 September 2006 - 04:22 PM

Hi all,

I need to strip all HTML tags from user input, save and .

I'm trying regular expressions, but am having big trouble getting those to work.

I thought of something like this (if found a tag with something else then 'i' remove tag): preg_replace(?(?=<[^i]+>)"");
But that doesn't work.

How would I go about that?

Thanks a lot!

Tim

#2 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 16 September 2006 - 04:25 PM

strip_tags
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#3 tvdhoff

tvdhoff
  • Members
  • PipPip
  • Member
  • 16 posts

Posted 16 September 2006 - 04:34 PM

d-oh...
thanks!

#4 yungbloodreborn

yungbloodreborn
  • Members
  • PipPipPip
  • Advanced Member
  • 45 posts
  • LocationCalifornia

Posted 21 September 2006 - 07:07 PM

Perfect! just what I needed,and I didn't even have to ask... :)

-YB




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users