You DO realize that the Groovy parser itself remove an escape level here? Which then leaves one \ for the template engine. So no surprise this (and only this) works.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
Mark Johnson-24 wrote:
>
> I understand, but the real question is how can one add the \ back in just
> before it hits the template? My efforts with
> somestring.replaceAll("\$","\\\$")
> have to date been unsuccessful, so any pointers for how to introduce an
> escape character before the '$' character will be appreciated.
>
I think this is a bug. looking at the code for SimpleTemplateEngine there's
special case code for ${} but not for standalone $. This code is very old.
At the time it was written the only way of inserting values into GStrings
was £{} the $identifier form was added later.
Could you raise a JIRA issue please?
People tend not to use Templates much these days (that's no a reason why
they should be broke, of course!). GStrings are very powerful and with
Closures can do pretty much whatever Templates can do.
If you give me some idea of what you are trying to achieve I'll see if I can
help you do it with GStrings.
John Wilson
--
View this message in context: http://www.nabble.com/Special-character-handling-%28%27%24%27%29-using-SimpleTemplate-tp15336061p15338681.html
Sent from the groovy - user mailing list archive at Nabble.com.
Paul.
Mark Johnson wrote:
> I understand, but the real question is how can one add the \ back in
> just before it hits the template? My efforts with
> somestring.replaceAll("\$","\\\$") have to date been unsuccessful, so
> any pointers for how to introduce an escape character before the '$'
> character will be appreciated.
>
> thanks
>
> mark
>
> On Feb 7, 2008 11:56 AM, Jürgen Hermann <Juergen...@webde.de