Sorry, premature send... So, now to escape quotes do:
#set( $foo = "This has ""quotes"" in it" ) #set( $foo = 'This is one with ''single quotes'' in it' ) On Wed, Jul 20, 2011 at 8:24 AM, Nathan Bubna <nbu...@gmail.com> wrote: > Using a backslash to escape quotes was never a supported feature. We > have never had quote escaping until the quote doubling feature was > added. > > On Wed, Jul 20, 2011 at 8:19 AM, Christopher Schultz > <ch...@christopherschultz.net> wrote: >> All, >> >> I've found an expression that parser in Velocity 1.4 but does not in >> Velocity 1.7: >> >> #set($linkedExpression = >> $linkedExpression.replaceAll('(?:fact|response|freeResponse)\(\s*([0-9]+)\s*[^)]*\)', >> "<a >> href=\"$link.setForward('clinician-edit-question')?id=${dollar}1\">${dollar}0</a>")) >> >> (That should be all on one line) >> >> The parse error is: >> >> org.apache.velocity.exception.ParseErrorException: Encountered "$link" >> at mytemplate.vm[line 95, column 123] >> Was expecting one of: >> "," ... >> ")" ... >> <WHITESPACE> ... >> >> Column 123 is, as you might imagine, the only reference to $link above. >> It looks like the \" is tripping-up the parser. >> >> I seem to recall come discussion about escaped characters in >> double-quoted strings a while ago. Did we decide that backslash woul no >> longer escape a double-quote in a string? What's the recommended >> technique for embedding double-quotes, now? >> >> #set($quote = '"') >> #set($foo = "quoted $quote thing") >> >> or >> >> #set($foo = "quoted $esc.q thing") >> >> or something else? >> >> Thanks, >> -chris >> >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org For additional commands, e-mail: user-h...@velocity.apache.org