velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Bubna <nbu...@gmail.com>
Subject Re: Expression okay in 14. but not parsable in 1.7
Date Wed, 20 Jul 2011 15:24:07 GMT
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
<chris@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-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message