Removing blank lines in report fields

Hi,

I am trying to format a multi-line text field in a report to remove blank lines. After a bit of reading I have come up with the following regular expressions but the editor won't accept them and it throws a syntax error. Am I even close!?

$F{followups}.replace("/^\s*\n/gm", "")
or
$F{followups}.replace(/(\r\n|\n|\r)/gm,"")

 

linker3000's picture
Joined: Apr 1 2009 - 2:04am
Last seen: 9 years 10 months ago

1 Answer:

After a bit more research and trial and error I found that the root cause of the problem was that the slashes needed double quoting ('\')

Also, I ended up using a different syntax:

$F{followups}.replaceAll("(?m)^[ \\t]*\\r?\\n", "")

linker3000's picture
Joined: Apr 1 2009 - 2:04am
Last seen: 9 years 10 months ago
Feedback
randomness