Removing brackets from velocity template (xml escaping)

627 Views Asked by At

I am new to velocity template. I am using velocity template to parse the data in xml format. Using below code to fetch userId: $esc.xml("$!userDetails.userId).replaceAll("&#[0-9a-fA-F]+;","")

Generated output: [ABC123] Excepted output: ABC123

Can someone please help me here. Also, I googled for apache velocity wiki but didn't find one. Also, it would be better if provide some wiki to fetch more information.

Thanks in advance!!

1

There are 1 best solutions below

0
On BEST ANSWER

Escape [] characters which are regular expression keywords

.replaceAll("&#\[0-9a-fA-F\]+;","")