test for newline before using gsub