> 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

Hi Becky,

What you're looking at is XML and it should be reasonably easy to
convert this into your desired output using CF's native XML tools.
Give this a shot:

<cfxml variable="myxml"><xml>#mystring#</xml></cfxml>

<cfoutput>
        Phone number changed from
        #myxml.xml.token1.xmlText# to
        #myxml.xml.token2.xmlText#
</cfoutput>

I could have given you an XSL template to translate the tokens, but
that's a little more involved -- I figured this would be shorter and
easier to follow in this case.

s. isaac dealey   954.522.6080
new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework

http://www.fusiontap.com
http://coldfusion.sys-con.com/author/4806Dealey.htm




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:4:218209
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