Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace a string with a pound sign in it

Status
Not open for further replies.

junkjones

Programmer
Jul 14, 2000
52
GB
Hi everyone,

I am pulling some HTML from a site and using the Replace() function to format it. However, anything with a hex value in it confuses CF.

Here is what I want to do:

<CFSET MyChart = #Replace(Mychart, '<TD bgcolor=#FFFFFF>', '<TD bgcolor=#000000>', 'ALL')#>

However, the replace function gets confused with the pound signs (understandably). I have tried escaping the pound signs (##). I then don't get an error, but it doesn't run the replace function because it can't find a match.

Has anyone figured out a work around for this? Thanks!
 
Did you try using the ascii code for the hash character like?...

<CFSET MyChart = #Replace(Mychart, '<TD bgcolor=' & chr(35) & 'FFFFFF>', '<TD bgcolor=' & chr(35) & '000000>', 'ALL')#>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top