ReReplace is for using a regular expression. Try Replace. You'll also
need to quadruple the double quotes, something like this should work:
#Replace("dill""s", """", "'", "ALL")#

That is, the content of each expression is enclosed in double quotes
in this example. When the expression itself contains a double-quote,
you have to double-that up to escape it. Sometimes when I just don't
want to deal with it, I'll enclose the expressions that contain
double-quotes in single quotes to make it easier to read, something
like:
#Replace('dill"s', '"', "'", 'ALL")#

If the only issue you face with the double-quotes is in queries, make
sure to use cfqueryparam, which handles escaping the double quotes,
single quotes, etc. If you need to capture the user input in another
form field, you might want to try replacing with the html safe
equivalent "
#replace(mystring, """", """, "ALL")#

Hope that helps.

Cheers,
Kris


> I'm trying to replace a double quote in a text field to a single quote. I've
> tried using ReReplace, but it still crashes the Cold Fusion server.
>
> What I've done is this:
>
> <cfoutput>#REReplace("dill"s",""","'","ALL")#</cfoutput>
>
> See, users tend to like using double quotes in a text field which breaks the
> SQL query. How can i check if there's a double quote in a #form.textfield#
> and remove it?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292463
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to