I happened to see a Railo JIRA ticket, suggesting to add a REEscape() function for Railo. It caught my attention, because I recently blogged about my RegExSafe() function, which does exactly the same. REEscape does sound more logical then RegExSafe, if you think about the already existent functions REFind, REReplace, and REMatch.
So, I took it upon me to create this new function for Railo, which was essentially nothing more then renaming the function, and (for now) creating an installer for it. I assume the function will become Railo core in the near future, presumably for version 3.3.
Installation
You can install the custom function by using your Railo server admin.
Go to your Server admin (default is http://localhost/railo-context/admin/server.cfm), click on Extension > Providers, and add the following url:
http://www.railodeveloper.com/ExtensionProvider.cfc
Then, go to Extension > Applications, and install the REEscape custom function.
Lastly, you have to restart Railo to be able to use the tag.
#1 by Colby Litnak - August 1, 2013 at 6:09 PM
REEscape('my {name} is bob')
does not escape the curly braces for me, seems like it should. Aren't their other characters to escape as well?
#2 by Paul Klinkenberg - August 1, 2013 at 9:23 PM
For example, this works:
[cfset x = rereplace("hi, my {name} is bob", REEscape('my {name} is bob'), "je m'appelle Bobby")/]
[cfdump var="#x#"/]
#3 by Colby Litnak - August 1, 2013 at 9:53 PM
Thanks, I learn something new every day. Fantastic.