Hi Sachin,
On Jun 25, 2008, at 3:28 PM, Sachin Mittal wrote:
Hi,
I am having this weired problem.
This is the velocity line
#set($esctext = $text.replaceAll("\\s+",""))
This should suppose to remove all the whitespaces in the text.
If I execute same in java code it works fine.
However if I use it in velocity code the same not working, we get
$esctext
same as $test.
Now when I change the velocity code to
#set($esctext = $text.replaceAll(" ",""))
this is working all fine, and if the $text has single whitespaces,
then this
gets replaced.
Thus bottom line is that replaceAll method is working fine and there
is some
issue with regexp only.
Could someone please let me know if this is general issue with
velocity or
something to do with xwiki.
Any reasons why its happening so?
I think that's because \ is the wiki syntax escape code so you need to
write \\\\ instead of \\
-Vincent