How do I replace line breaks?
<p>I am trying to replace line breaks with a comma in javascript but the code doesn't seem to work.</p>

<pre><code>var data = "Series
Manga
Games
Artbooks
Visual Novels"
var output = data.replace(/(\r\n|\n|\r)/gm,",");
alert(output);
</code></pre>

<p>here you can see a online version <a href="http://jsfiddle.net/CBvpS/" rel="nofollow">http://jsfiddle.net/CBvpS/</a>
Anyone know how to fix it?</p>
