Boris Yasen
10/01/2024, 8:30 PM<#assign text = "Testing
Testing2,
Testing3" />
<#assign cleaned_text = text?replace("[\\r\\n]+", ",", "r")>
${cleaned_text}
Then it shows as expected
Testing
Testing2, Testing3
However I have a field with same text but if I assign that value it doesn't work.
<#assign text = record.custfield_id />
<#assign cleaned_text = text?replace("[\\r\\n]+", ",", "r")>
${cleaned_text}
This shows the original text.Celigo AI
10/01/2024, 8:30 PMAI generated answer (using internal Slack threads):It seems like you are trying to replace line breaks with commas in a freemarker PDF template using regex. From the conversations, it appears that the regex works fine when you use a string directly, but it doesn't work when you use a field from a record. The issue might be due to the way the field value is being interpreted. It's possible that the field value is not being recognized as a string with line breaks, but rather as a single line string. This could be due to how the data is stored or retrieved from the record. One suggestion from the conversations is to copy the value from the field into a text editor that displays non-printing characters. This could help you identify if there are any hidden characters that might be causing the issue. Another suggestion is to use the replace functionality with regex in freemarker. Here is an example provided in the conversations:
${xxxxxx?replace('<[^>]+>','','r')}
. This example replaces all HTML tags in the string with an empty string.
If these suggestions don't work, you might need to look into how the data is being stored in the field and how it's being retrieved. It's possible that the data is not being stored or retrieved as expected, which could be causing the issue.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
10/01/2024, 8:30 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.851438224
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.841753185
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.839089513
Celigo AI
10/01/2024, 8:30 PM