The ?replace filter in FreeMarker can be used to perform basic string replacements based on regular expressions. It allows you to search for a pattern in a string and replace it with another string. It works as follows:
${expression?replace(regex, replacement)}: This syntax is used to apply the ?replace filter to the expression.
- regex: This is a regular expression pattern used to match the portion of the string you want to replace.
- replacement: This is the string to replace the matched portion.
Eg:
<#list check.expense as expense>
<tr> <td>${(expense.grossamt?replace(“[^0-9.]”, “”, “r”)!0)}</td> </tr>
</#list>