Hmmm, in that case I'd probably replace out any JS ones first, then run the above, then swap back in the JS ones.
And the easiest way of doing that would probably be something like this: <cfset Text = JREReplace(Text,"(?=<script[^>]*>).*?(?=</script>)",RemoveJsAmp,"all")/> [code from above] <cfset Text = JREReplace(Text,"(?=<script[^>]*>).*?(?=</script>)",RestoreJsAmp,"all")/> Where JREReplace is a handy function by Ben Nadel which allows use of regex callback functions. ( See http://www.bennadel.com/index.cfm?dax=blog:191.view ) And the two callback functions mentioned above would be along the lines of: <cffunction name="RemoveJsAmp"> <cfargument name="Text"/> <cfreturn REReplace(Arguments.Text,'&','{{AMP}}','all')/> </cffunction> <cffunction name="RestoreJsAmp"> <cfargument name="Text"/> <cfreturn REReplace(Arguments.Text,'{{AMP}}','&','all')/> </cffunction> > > Assuming what you're actually asking is how to escape any ampersands > > > that are not part of an existing entity, try this... > > Hhm, yeah that might work. I really don't need to worry too much about > any ampersands outside links (without getting too into detail, they > are generally escaped earlier) but wouldn't mind making sure they are > all done. Problem is if the text block has any javascript code > embedded, which is possible, I don't want to replace ampersands in > there too. > > --- Mary Jo > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Create Web Applications With ColdFusion MX7 & Flex 2. Build powerful, scalable RIAs. Free Trial http://www.adobe.com/products/coldfusion/flex2/ Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:272311 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

