Is there any way to replace the new line character on free marker? I am trying this:
<#assign str = str?replace("(\r\n)+", "</p><p>")>
which worked in Java, but not in freemarker. How can I do this?
Ok, I found the problem. The replace function needs to know if the expresion is a regex, so I had to add 'r' as a parameter
<#assign str = str?replace("(\r\n)+", "</p><p>",'r')>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.