There are probably a number of ways to do this.  Here's one:

(dbfield is your query results field that has the text in it)
<cfset newtext = replace(dbfield,"<token1>","Phone number changed from ","all") 
>
<cfset newtext = replace(newtext,"</token1><token2>"," to ","all") >
<cfset newtext = replace(newtext,"</token2>","","all")>

If they are multiple possibilities of case, use replacenocase instead.

Dave


-----Original Message-----
From: Jones, Becky [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 14, 2005 10:08 AM
To: CF-Talk
Subject: Replace String


I need to be able to search a string and make multiple replacements in
it.  
For example,  I have a string that is coming out of the database with
weird characters
<token1>410-333-1234</token1><token2>410-333-4321</token2>
I want to replace <token1> with "Phone number changed from
And I want to replace </token1><token2> with "to"
And simply delete </token2>

Any help is much appreciated.
Thank you
******************************************************************************************
The information contained in this message, including attachments, may contain 
privileged or confidential information that is intended to be delivered only to 
the 
person identified above. If you are not the intended recipient, or the person 
responsible for delivering this message to the intended recipient, ALLTEL 
requests 
that you immediately notify the sender and asks that you do not read the 
message or its 
attachments, and that you delete them without copying or sending them to anyone 
else. 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:4:218207
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to