<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Comments on snippet: 'Replace newlines with BR (platform safe)'</title>
<link>http://snipplr.com</link>
<description>Snipplr comments feed'</description>
<language>en-us</language>
<pubDate>Tue, 14 Feb 2012 05:32:54 GMT</pubDate>
<item>
<title>Emmanuel said on 11/19/10</title>
<link>http://snipplr.com/view/634/replace-newlines-with-br-platform-safe/</link>
<description><![CDATA[ Or try

`str.replace(/([^>\%0D\%0A]?)(\%0D\%0A|%0A\%0D|\%0D|%0A)/g, '$1$2');` ]]></description>
<pubDate>Fri, 19 Nov 2010 18:44:43 GMT</pubDate>
<guid>http://snipplr.com/view/634/replace-newlines-with-br-platform-safe/</guid>
</item>
<item>
<title>muggo said on 9/2/10</title>
<link>http://snipplr.com/view/634/replace-newlines-with-br-platform-safe/</link>
<description><![CDATA[ Um. I take that back. This site strips html and reformats code... pretty silly for a code snippet site. My bad, I apologise. ]]></description>
<pubDate>Thu, 02 Sep 2010 15:18:45 GMT</pubDate>
<guid>http://snipplr.com/view/634/replace-newlines-with-br-platform-safe/</guid>
</item>
<item>
<title>muggo said on 9/2/10</title>
<link>http://snipplr.com/view/634/replace-newlines-with-br-platform-safe/</link>
<description><![CDATA[ Not only is this really ugly code it doesn't work. nickwicks addition doesn't either.

This isn't much prettier but at least it works

function nl2br (str) {   
  var breakTag = '';
  return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1'+ breakTag +'$2');
} ]]></description>
<pubDate>Thu, 02 Sep 2010 15:17:15 GMT</pubDate>
<guid>http://snipplr.com/view/634/replace-newlines-with-br-platform-safe/</guid>
</item>
<item>
<title>nickwick76 said on 8/16/09</title>
<link>http://snipplr.com/view/634/replace-newlines-with-br-platform-safe/</link>
<description><![CDATA[ When the text doesn't contain a newline of any kind, variable 're_nlchar' is not defined and an error is raised when returning from the function.

A suggestion would be to replace the return statement with the following:

if (typeof(re_nlchar) == "undefined") {
	return unescape( text );
} else {
	return unescape( text.replace(re_nlchar,'') );	
} ]]></description>
<pubDate>Sun, 16 Aug 2009 16:57:13 GMT</pubDate>
<guid>http://snipplr.com/view/634/replace-newlines-with-br-platform-safe/</guid>
</item>
<item>
<title>Roshambo said on 8/2/06</title>
<link>http://snipplr.com/view/634/replace-newlines-with-br-platform-safe/</link>
<description><![CDATA[ <p>The ironic thing about this post is that it itself could use some newline replacement.</p>\n ]]></description>
<pubDate>Wed, 02 Aug 2006 00:00:00 GMT</pubDate>
<guid>http://snipplr.com/view/634/replace-newlines-with-br-platform-safe/</guid>
</item>
<item>
<title>cochambre said on 8/2/06</title>
<link>http://snipplr.com/view/634/replace-newlines-with-br-platform-safe/</link>
<description><![CDATA[ <p>Tried that. Snipplr just didn\'t care whatever I typed. See the \\r\\n ?</p>\n ]]></description>
<pubDate>Wed, 02 Aug 2006 00:00:00 GMT</pubDate>
<guid>http://snipplr.com/view/634/replace-newlines-with-br-platform-safe/</guid>
</item>
<item>
<title>cochambre said on 8/2/06</title>
<link>http://snipplr.com/view/634/replace-newlines-with-br-platform-safe/</link>
<description><![CDATA[ <p>Something has broken with this site.</p>\n ]]></description>
<pubDate>Wed, 02 Aug 2006 00:00:00 GMT</pubDate>
<guid>http://snipplr.com/view/634/replace-newlines-with-br-platform-safe/</guid>
</item>
<item>
<title>tylerhall said on 8/2/06</title>
<link>http://snipplr.com/view/634/replace-newlines-with-br-platform-safe/</link>
<description><![CDATA[ <p>Yep, during last night's update I introduced a bug that was messing with newlines. It's been fixed. Sorry about that :)</p>
 ]]></description>
<pubDate>Wed, 02 Aug 2006 00:00:00 GMT</pubDate>
<guid>http://snipplr.com/view/634/replace-newlines-with-br-platform-safe/</guid>
</item>
<item>
<title>tylerhall said on 8/2/06</title>
<link>http://snipplr.com/view/634/replace-newlines-with-br-platform-safe/</link>
<description><![CDATA[ <p>I've gone through all of the affected snippets and corrected them.</p>
 ]]></description>
<pubDate>Wed, 02 Aug 2006 00:00:00 GMT</pubDate>
<guid>http://snipplr.com/view/634/replace-newlines-with-br-platform-safe/</guid>
</item>
</channel>
</rss>
