<p>I have a data stream that may contain \r, \n, \r\n, \n\r or any combination of them.  Is there a simple way to normalize the data to make all of them simply become \r\n pairs to make display more consistent?</p>

<p>So something that would yield this kind of translation table:</p>

<pre><code>\r     --&gt; \r\n
\n     --&gt; \r\n
\n\n   --&gt; \r\n\r\n
\n\r   --&gt; \r\n
\r\n   --&gt; \r\n
\r\n\n --&gt; \r\n\r\n
</code></pre>

A Regex would help.. could do something roughly like this..
(\r\n|\n\n|\n\r|\r|\n) replace with \r\n
This regex produced these results from the table posted (just testing left side) so a replace should normalize.
```
```
\r   => \r 
\n   => \n 
\n\n => \n\n 
\n\r => \n\r 
\r\n => \r\n 
\r\n => \r\n 
\n   => \n
```
```