How do i remove empty lines from a string? I have tried some_string = some_string.gsub(/^$/, \"\");
and much more, but nothing works.
You could try to replace all occurrences of 2 or more line breaks with just one:
my_string.gsub(/\n{2,}/, '\n')