Another Question... String Handling (Strip HTML)

View: New views
9 Messages — Rating Filter:   Alert me  

Another Question... String Handling (Strip HTML)

by Robert Harrison-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

OK, this isn't so stupid a question.

Now I've got the string I want. It's HTML tagged and I want to display
only the text, not the code; and I certainly don't want to execute the
code.

I can spend the next two hours or three hours writing a procedure that
looks for each occurance of  < and stips out every up to >, but it seems
there should already be something that strips HTML from a string.

Is there something in Cold Fusion that strips HTML from string, or does
someone have an easy strip routine??? I don't know which tags will be
used an what the content of those tags will be.

The < > seem it would be the most reliable key.

Thanks
 

Robert B. Harrison
Director of Interactive Services, Ext. 205

155 East Main Street
Smithtown, NY 11787
P (631) 361-4400
F (631) 361-6400
http://www.linx.com
 
 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:25:2056
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/25
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:25
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.25
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Parent Message unknown RE: Another Question... String Handling (Strip HTML)

by Rob Mackenzie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm sure I'll be the fourth or fifth answer here, but try one of the
following:

HTMLEditFormat() or HTMLCodeFormat()...no color coding, but escapes
characters...

Rob Mackenzie
Jera Technology

-----Original Message-----
From: Robert Harrison [mailto:RobertH@...]
Sent: Wednesday, November 23, 2005 11:30 AM
To: NYCFUG
Subject: Another Question... String Handling (Strip HTML)

OK, this isn't so stupid a question.

Now I've got the string I want. It's HTML tagged and I want to display
only the text, not the code; and I certainly don't want to execute the
code.

I can spend the next two hours or three hours writing a procedure that
looks for each occurance of  < and stips out every up to >, but it seems
there should already be something that strips HTML from a string.

Is there something in Cold Fusion that strips HTML from string, or does
someone have an easy strip routine??? I don't know which tags will be
used an what the content of those tags will be.

The < > seem it would be the most reliable key.

Thanks
 

Robert B. Harrison
Director of Interactive Services, Ext. 205

155 East Main Street
Smithtown, NY 11787
P (631) 361-4400
F (631) 361-6400
http://www.linx.com
 
 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:25:2057
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/25
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:25
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.25
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Re: Another Question... String Handling (Strip HTML)

by R.J.Siegel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You can use CF list functions to get every other list item
using delimiters of "<>".

This of course would assume the html is correct and there are
no stray "<>"s in the actual text, but anything you write would
probably make the same assumptions.


Robert Harrison wrote:

> OK, this isn't so stupid a question.
>
> Now I've got the string I want. It's HTML tagged and I want to display
> only the text, not the code; and I certainly don't want to execute the
> code.
>
> I can spend the next two hours or three hours writing a procedure that
> looks for each occurance of  < and stips out every up to >, but it seems
> there should already be something that strips HTML from a string.
>
> Is there something in Cold Fusion that strips HTML from string, or does
> someone have an easy strip routine??? I don't know which tags will be
> used an what the content of those tags will be.
>
> The < > seem it would be the most reliable key.
>
> Thanks
>  
>
> Robert B. Harrison
> Director of Interactive Services, Ext. 205
>
> 155 East Main Street
> Smithtown, NY 11787
> P (631) 361-4400
> F (631) 361-6400
> http://www.linx.com
>  
>  
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:25:2058
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/25
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:25
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.25
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Parent Message unknown RE: Another Question... String Handling (Strip HTML)

by Cook, Scott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I thought REReplaceNoCase would have been the answer.  I'm not a regular expression guy but you want to replace <xxx> and </xxx) with ''

-----Original Message-----
From: Rob Mackenzie [mailto:rob@...]
Sent: Wednesday, November 23, 2005 11:43 AM
To: NYCFUG
Subject: RE: Another Question... String Handling (Strip HTML)


I'm sure I'll be the fourth or fifth answer here, but try one of the
following:

HTMLEditFormat() or HTMLCodeFormat()...no color coding, but escapes
characters...

Rob Mackenzie
Jera Technology

-----Original Message-----
From: Robert Harrison [mailto:RobertH@...]
Sent: Wednesday, November 23, 2005 11:30 AM
To: NYCFUG
Subject: Another Question... String Handling (Strip HTML)

OK, this isn't so stupid a question.

Now I've got the string I want. It's HTML tagged and I want to display
only the text, not the code; and I certainly don't want to execute the
code.

I can spend the next two hours or three hours writing a procedure that
looks for each occurance of  < and stips out every up to >, but it seems
there should already be something that strips HTML from a string.

Is there something in Cold Fusion that strips HTML from string, or does
someone have an easy strip routine??? I don't know which tags will be
used an what the content of those tags will be.

The < > seem it would be the most reliable key.

Thanks
 

Robert B. Harrison
Director of Interactive Services, Ext. 205

155 East Main Street
Smithtown, NY 11787
P (631) 361-4400
F (631) 361-6400
http://www.linx.com
 
 





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:25:2059
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/25
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:25
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.25
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Parent Message unknown RE: Another Question... String Handling (Strip HTML)

by Robert Harrison-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

OK. That was easier than I at first thought. This worked just fine:

        #REReplaceNoCase(myhtmlstring, "<[^>]*>","","ALL")#
 


Robert B. Harrison
Director of Interactive Services, Ext. 205

155 East Main Street
Smithtown, NY 11787
P (631) 361-4400
F (631) 361-6400
http://www.linx.com
 
 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Protect your mail server with built in anti-virus protection. It's not only good for you, it's good for everybody.
http://www.houseoffusion.com/banners/view.cfm?bannerid=39

Message: http://www.houseoffusion.com/lists.cfm/link=i:25:2062
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/25
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:25
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.25
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Parent Message unknown RE: Another Question... String Handling (Strip HTML)

by Andrew Thielen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The power of REGEX at your fingertips:

Mystringvar=REReplace(mystringvar,"<(.|\n)*?>","","ALL")

That should strip out all HTML only and leave everything else.

-----Original Message-----
From: Robert Harrison [mailto:RobertH@...]
Sent: Wednesday, November 23, 2005 11:30 AM
To: NYCFUG
Subject: Another Question... String Handling (Strip HTML)

OK, this isn't so stupid a question.

Now I've got the string I want. It's HTML tagged and I want to display
only the text, not the code; and I certainly don't want to execute the
code.

I can spend the next two hours or three hours writing a procedure that
looks for each occurance of  < and stips out every up to >, but it seems
there should already be something that strips HTML from a string.

Is there something in Cold Fusion that strips HTML from string, or does
someone have an easy strip routine??? I don't know which tags will be
used an what the content of those tags will be.

The < > seem it would be the most reliable key.

Thanks
 

Robert B. Harrison
Director of Interactive Services, Ext. 205

155 East Main Street
Smithtown, NY 11787
P (631) 361-4400
F (631) 361-6400
http://www.linx.com
 
 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:25:2060
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/25
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:25
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.25
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Parent Message unknown RE: Another Question... String Handling (Strip HTML)

by Cook, Scott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Google is your friend

http://www.sitepoint.com/forums/printthread.php?t=146096

REReplaceNoCase(message,"<[^>]*>","","ALL")

-----Original Message-----
From: Robert Harrison [mailto:RobertH@...]
Sent: Wednesday, November 23, 2005 11:30 AM
To: NYCFUG
Subject: Another Question... String Handling (Strip HTML)


OK, this isn't so stupid a question.

Now I've got the string I want. It's HTML tagged and I want to display
only the text, not the code; and I certainly don't want to execute the
code.

I can spend the next two hours or three hours writing a procedure that
looks for each occurance of  < and stips out every up to >, but it seems
there should already be something that strips HTML from a string.

Is there something in Cold Fusion that strips HTML from string, or does
someone have an easy strip routine??? I don't know which tags will be
used an what the content of those tags will be.

The < > seem it would be the most reliable key.

Thanks
 

Robert B. Harrison
Director of Interactive Services, Ext. 205

155 East Main Street
Smithtown, NY 11787
P (631) 361-4400
F (631) 361-6400
http://www.linx.com
 
 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Protect your mail server with built in anti-virus protection. It's not only good for you, it's good for everybody.
http://www.houseoffusion.com/banners/view.cfm?bannerid=39

Message: http://www.houseoffusion.com/lists.cfm/link=i:25:2061
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/25
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:25
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.25
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Parent Message unknown RE: Another Question... String Handling (Strip HTML)

by Cook, Scott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Come on one more, see if I can go 3 for 3 ;-)

-----Original Message-----
From: Robert Harrison [mailto:RobertH@...]
Sent: Wednesday, November 23, 2005 11:51 AM
To: NYCFUG
Subject: RE: Another Question... String Handling (Strip HTML)


OK. That was easier than I at first thought. This worked just fine:

        #REReplaceNoCase(myhtmlstring, "<[^>]*>","","ALL")#
 


Robert B. Harrison
Director of Interactive Services, Ext. 205

155 East Main Street
Smithtown, NY 11787
P (631) 361-4400
F (631) 361-6400
http://www.linx.com
 
 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:25:2063
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/25
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:25
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.25
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Parent Message unknown RE: Another Question... String Handling (Strip HTML)

by Andrew Thielen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yeah that's a better regex for the task. Actually one more change should
improve the efficiency a bit:

"<[^>]+>"

*=occurs zero or more times
+=occurs one or more times

-----Original Message-----
From: Cook, Scott [mailto:scott.cook@...]
Sent: Wednesday, November 23, 2005 11:53 AM
To: NYCFUG
Subject: RE: Another Question... String Handling (Strip HTML)

Google is your friend

http://www.sitepoint.com/forums/printthread.php?t=146096

REReplaceNoCase(message,"<[^>]*>","","ALL")

-----Original Message-----
From: Robert Harrison [mailto:RobertH@...]
Sent: Wednesday, November 23, 2005 11:30 AM
To: NYCFUG
Subject: Another Question... String Handling (Strip HTML)


OK, this isn't so stupid a question.

Now I've got the string I want. It's HTML tagged and I want to display
only the text, not the code; and I certainly don't want to execute the
code.

I can spend the next two hours or three hours writing a procedure that
looks for each occurance of  < and stips out every up to >, but it seems
there should already be something that strips HTML from a string.

Is there something in Cold Fusion that strips HTML from string, or does
someone have an easy strip routine??? I don't know which tags will be
used an what the content of those tags will be.

The < > seem it would be the most reliable key.

Thanks
 

Robert B. Harrison
Director of Interactive Services, Ext. 205

155 East Main Street
Smithtown, NY 11787
P (631) 361-4400
F (631) 361-6400
http://www.linx.com
 
 





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:25:2064
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/25
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:25
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.25
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54