See http://velocity.apache.org/engine/devel/user-guide.html#stringliterals
Try #set($esctext = $text.replaceAll('\\s+',""))
>
> 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?
>
> Thanks
> Sachin
>
>
> -----
> http://www.assembla.com/wiki/show/sachin_mittal about me:
> --
> View this message in context:
> http://www.nabble.com/Reg-exp-not-working-in-velocity-code-tp18112487p18112487.html
> Sent from the XWiki- Dev mailing list archive at Nabble.com.
>
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
>
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs