To match all newline characters, /\n/g. In order to replace them, you need to specify a language. For example, in JavaScript:
str.replace(/\n/g, ",");
Live example
A simple Google search reveals how it’s done in C#:
Regex.Replace(str, "\n", ",");
After reading some of your comments, I searched how to do it in Perl. This should do it:
s/\n/,/g;