I found this post by Google with question:
May be my answer helps to another users:
Just type
For tags with 2 and big letters (br,img,hr) try this:
http://bytes.com/topic/php/answers/1...e-not-all-tags "I need to replace all possible html tags in user input but don't want to
replace bold and italic start and end tags, so I made folowing line, but
it replaces only "one-letter-tags" like paragraf or underline tag, it
doesn't replace body, div, span tags...
Can anyone help me with this?
"
replace bold and italic start and end tags, so I made folowing line, but
it replaces only "one-letter-tags" like paragraf or underline tag, it
doesn't replace body, div, span tags...
Can anyone help me with this?
Code:
$txt = preg_replace('/<\/?[^bi]>/i', ' ', $txt);
Just type
Code:
$txt = preg_replace('/\<\/?[^bi][^>]*\>/sU', ' ', $txt);
Code:
$txt = preg_replace('/\<\/?(?!br|img|hr)\b[^>]*\>/sU', ' ', $txt);
Comment