How to handle word boundary in FreeMarker when replacing string? -


when using freemarker, want replace words in template, replace function not handle word boundary, output messed. possible handle word boundary in freemarker? thanks!

edit: word boundary question solved, have question backreference.

i found should use third optional flag 'r' tell freemarker using regular expression. purpose, use this:

block?replace("\\b${arg}\\b", "__${arg}", "r") 

note must use \\b word boundary matching.


Comments