velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Expression okay in 14. but not parsable in 1.7
Date Wed, 20 Jul 2011 15:19:54 GMT
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



Mime
View raw message