You may have to use a negative lookahead.  Try something like this:

<(?!\/?(br|b|span|i|strong|div|p))[^>]*>

This hasn't been tested and is purely from memory, but I think that
(or something close to it) should remove any tag that is *NOT* the
open or closing tag of one you listed.

For more information on negative lookaheads you can look at the
livedocs or google 'regex negative lookahead'.

hth.

On 4/13/06, cf coder <[EMAIL PROTECTED]> wrote:
> Hello Everybody,
>
> I need your help with regular expressions. I'm trying to strip out HTML tags 
> from a string to pass it to a flash movie.
>
> I've found a script that does this but the problem is that I want to keep 
> some html formatting specifically the following tags:
> <b>, <br>, <span>, <i>, <strong>, <div>, <p>
>
> Here is the code:
>
> <cfscript>
> function StripHTML(str) {
> return REReplaceNoCase(str,"<[^>]*>","<br>","ALL");
> }
> </cfscript>
>
> <cfset logtext = "<table>
> <tr><td><p><span class=body>This is some example text</span></p></td></tr>
> <tr><td><b>Friday 17 march, 2006</b><br>12:54 PM</td></tr>
> </table>">
>
> <cfset str = StripHTML(logtext)>
>
> The above script strips out the everything between the opening and closing 
> angle brackets "<" and ">".
>
> Is there any way to tell the regular expression to do the above but not 
> process the following tags: <b>, <br>, <span>, <i>, <strong>, <div>, <p>
>
>
> I would be really greatful if someone could post the regular expression to do 
> this.
>
> Best regards,
> cfcoder
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237697
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to