![]() |
Trouble using regexps to explude HTML tags
Hello:
My goal is to remove all HTML tags except the following: // <b> and </b> = Bold; // <i> and </i> = Italic; // <u> and </u> = Underline; // <ul> and </ul> = List; // <ol> and </ol> = List; // <li> and </li> = Bullet; // <br> = Line Break; So if I use the following line: PHP Code:
My question is how to "reverse" it? |
You're looking for ^
On a side note, your pattern will exclude any of those tags that include attributes such as a style, class or id attribute. Not sure if that matters to you or not, just thought I would give you the heads up. |
Thanks. But where exactly do I put this ^?
And yes, again, all I need to let go through is the plain text and the following tags: <b>, </b>, <i>, </i>, <u>, </u>, <ul>, </ul>, <ol>, </ol>, <li>, </li>, <br>. I'm sorry I'm not really good with regexs. |
~</?[^b|i|u|ul|ol|li|br]+?>~
^ when used in a range means anything but ... Sorry I'd go into more detail but I'm making dinner. |
Quote:
PHP Code:
<a href="123"> or even <le> |
Dinner (especially steak dinner) trumps writing regular expressions.
It also trumps logical thought process. Such as using something more appropriate for the job at hand. php Code:
|
Thanks! You're the man!
|
| All times are GMT. The time now is 09:32 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0