Correct me if I'm wrong, but wont this just replace the first occurrence of \n...I think we need to have the global modifier symbol ('g') at the end of the regexp :
This is the expression I use as well. Replacing just the \n assures it works well even if there are no \r around (Unix environment). If there are (Windoze or MAC) I think they can just stay there, but one could get rid of them using: