Regex replace all newline characters with comma

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;

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)