a much quicker way involves only one line:

<cfset strippedOfHTML = REReplaceNoCase(textWithHTML, "<[^>]*>", "", "ALL")>

this removes ALL HTML from a string.

> -----Original Message-----
> From: Louis Klepner [mailto:[EMAIL PROTECTED]]
> Sent: 13 March 2002 16:38
> To: CF-Talk
> Subject: RE: CFSEARCH results: HTML vs. Plain Text
> 
> 
> Ahhh! Very good, work like a charm- Thanks!
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]On Behalf Of 
> Peter Dray
> > Sent: Wednesday, March 13, 2002 10:13 AM
> > To: CF-Talk
> > Subject: RE: CFSEARCH results: HTML vs. Plain Text
> >
> >
> > Hurahh, at last something I can help with....
> >
> > I am duty bound to point out that I grabbed this code from 
> a custom tag on
> > the dev exchange, their are plenty there.
> >
> >
> > <cfset source="#yourTextString#">
> > <cfscript>
> >     EndLoop = 0;
> >     StartPosition = 1;
> >             while (StartPosition gt 0){
> >                     StartPosition =
> > REFindNoCase("</*[[:alpha:]]",source);
> >                     if(StartPosition gt 0){
> >                             
> endPosition=Find(">",source,StartPosition);
> >                             if(endPosition gt 0){
> >                                     source =
> > RemoveChars(source,StartPosition,EndPosition-StartPosition+1);
> >                                     startPosition = 1;
> >                             }
> >                     }else{
> >                             endLoop = 1;
> >                     }
> >             }
> >     OutputText=trim(source);
> > </cfscript>
> >
> > <cfoutput>#source#</cfoutput>
> >
> >
> > -----Original Message-----
> > From: Louis Klepner [mailto:[EMAIL PROTECTED]]
> > Sent: 13 March 2002 14:31
> > To: CF-Talk
> > Subject: CFSEARCH results: HTML vs. Plain Text
> >
> >
> > Hello,
> >
> > I've got lightly formatted HTML in a database (bold / 
> italic / lists). I'm
> > using the CFINDEX Query function to fill a CFCOLLECTION. My 
> problem is the
> > HTML. I'd prefer to display my search results as plain text. Is
> > there a way
> > to strip HTML formatting? I've tried the string functions, but
> > just haven't
> > figured out how to eliminate the HTML. Can someone give me a couple
> > pointers?
> >
> > Thanks,
> > Lou Klepner
> >
> >
> > 
> 
______________________________________________________________________
Why Share?
  Dedicated Win 2000 Server · PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to