<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Replacing carriage returns and line feeds with newline characters using Regular Expressions</title>
	<atom:link href="http://blog.flexexamples.com/2008/12/16/replacing-carriage-returns-and-line-feeds-with-newline-characters-using-regular-expressions/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com/2008/12/16/replacing-carriage-returns-and-line-feeds-with-newline-characters-using-regular-expressions/</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Mon, 13 Feb 2012 01:38:13 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: madhu</title>
		<link>http://blog.flexexamples.com/2008/12/16/replacing-carriage-returns-and-line-feeds-with-newline-characters-using-regular-expressions/comment-page-1/#comment-4057</link>
		<dc:creator>madhu</dc:creator>
		<pubDate>Mon, 18 May 2009 13:34:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/12/16/replacing-carriage-returns-and-line-feeds-with-newline-characters-using-regular-expressions/#comment-4057</guid>
		<description>Ex:
string1=”d.o.t”
findString=”.o”
repString = “o”
string2 = MyReplaceMethod(string1,findString,repString)
then string2 must be “do.t”

findString=”.”
repString = “”
string2 = MyReplaceMethod(string1,findString,repString)
then string2 must be “dot”

examples corrected

Thank you
Madhu</description>
		<content:encoded><![CDATA[<p>Ex:<br />
string1=”d.o.t”<br />
findString=”.o”<br />
repString = “o”<br />
string2 = MyReplaceMethod(string1,findString,repString)<br />
then string2 must be “do.t”</p>
<p>findString=”.”<br />
repString = “”<br />
string2 = MyReplaceMethod(string1,findString,repString)<br />
then string2 must be “dot”</p>
<p>examples corrected</p>
<p>Thank you<br />
Madhu</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhu</title>
		<link>http://blog.flexexamples.com/2008/12/16/replacing-carriage-returns-and-line-feeds-with-newline-characters-using-regular-expressions/comment-page-1/#comment-4058</link>
		<dc:creator>madhu</dc:creator>
		<pubDate>Mon, 18 May 2009 13:31:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/12/16/replacing-carriage-returns-and-line-feeds-with-newline-characters-using-regular-expressions/#comment-4058</guid>
		<description>I want to write a method which replaces all the places in a given string.

Ex:
string1=&quot;d.o.t&quot;
findString=&quot;.o&quot;
repString = &quot;o&quot;
string2 = MyReplaceMethod(string1,findString,repString)
then string2 must be &quot;do.t&quot;

repString = &quot;&quot;
string2 = MyReplaceMethod(string1,findString,repString)
then string2 must be &quot;dot&quot;

I tried to use regex but it is having many problems, it uses some characters as special characters which cannot be used in the find string, like .,[,\,* etc.
So how to replace using regex if find string contains these special characters

Without using regex, I was able to do
1. split the string with find string
2. append them back using the replace string in the middle

This works but i want a procedure which uses regex and works with any type of characters

Thank you
Madhu</description>
		<content:encoded><![CDATA[<p>I want to write a method which replaces all the places in a given string.</p>
<p>Ex:<br />
string1=&#8221;d.o.t&#8221;<br />
findString=&#8221;.o&#8221;<br />
repString = &#8220;o&#8221;<br />
string2 = MyReplaceMethod(string1,findString,repString)<br />
then string2 must be &#8220;do.t&#8221;</p>
<p>repString = &#8220;&#8221;<br />
string2 = MyReplaceMethod(string1,findString,repString)<br />
then string2 must be &#8220;dot&#8221;</p>
<p>I tried to use regex but it is having many problems, it uses some characters as special characters which cannot be used in the find string, like .,[,\,* etc.<br />
So how to replace using regex if find string contains these special characters</p>
<p>Without using regex, I was able to do<br />
1. split the string with find string<br />
2. append them back using the replace string in the middle</p>
<p>This works but i want a procedure which uses regex and works with any type of characters</p>
<p>Thank you<br />
Madhu</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nullnod</title>
		<link>http://blog.flexexamples.com/2008/12/16/replacing-carriage-returns-and-line-feeds-with-newline-characters-using-regular-expressions/comment-page-1/#comment-4061</link>
		<dc:creator>nullnod</dc:creator>
		<pubDate>Wed, 08 Apr 2009 16:06:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/12/16/replacing-carriage-returns-and-line-feeds-with-newline-characters-using-regular-expressions/#comment-4061</guid>
		<description>use the + to denote you want one or more of either char in the charclass.  it reads well too.  sometimes the pipe is easy to overlook.

loremTEXT2 = loremTEXT.replace(/[\r\n]+/g, &quot;\n&quot;);</description>
		<content:encoded><![CDATA[<p>use the + to denote you want one or more of either char in the charclass.  it reads well too.  sometimes the pipe is easy to overlook.</p>
<p>loremTEXT2 = loremTEXT.replace(/[\r\n]+/g, &#8220;\n&#8221;);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg</title>
		<link>http://blog.flexexamples.com/2008/12/16/replacing-carriage-returns-and-line-feeds-with-newline-characters-using-regular-expressions/comment-page-1/#comment-4056</link>
		<dc:creator>Greg</dc:creator>
		<pubDate>Fri, 27 Mar 2009 14:47:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/12/16/replacing-carriage-returns-and-line-feeds-with-newline-characters-using-regular-expressions/#comment-4056</guid>
		<description>Nice,

Adding on to what Jason said, Mac OS 9 and lower computers use only carraige returns (&quot;\r&quot;) for a newline characters so you can even do it this way as well.

`loremTEXT.replace(/\r\n&#124;\r/gm, “\n”);`

using the pipe, &quot;&#124;&quot;, character will check for &quot;\r\n&quot; or &quot;\r&quot; and replace with &quot;\n&quot;.</description>
		<content:encoded><![CDATA[<p>Nice,</p>
<p>Adding on to what Jason said, Mac OS 9 and lower computers use only carraige returns (&#8220;\r&#8221;) for a newline characters so you can even do it this way as well.</p>
<p>`loremTEXT.replace(/\r\n|\r/gm, “\n”);`</p>
<p>using the pipe, &#8220;|&#8221;, character will check for &#8220;\r\n&#8221; or &#8220;\r&#8221; and replace with &#8220;\n&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason</title>
		<link>http://blog.flexexamples.com/2008/12/16/replacing-carriage-returns-and-line-feeds-with-newline-characters-using-regular-expressions/comment-page-1/#comment-4059</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Wed, 25 Feb 2009 20:07:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/12/16/replacing-carriage-returns-and-line-feeds-with-newline-characters-using-regular-expressions/#comment-4059</guid>
		<description>Using a character class there means that you&#039;ll replace either \r OR \n with \n, and thus you&#039;ll still have double line returns in Flex. Remove the [] so it&#039;s just
`loremTEXT.replace(/\r\n/gm, &quot;\n&quot;);`
To convert line endings from Windows style to Unix style.</description>
		<content:encoded><![CDATA[<p>Using a character class there means that you&#8217;ll replace either \r OR \n with \n, and thus you&#8217;ll still have double line returns in Flex. Remove the [] so it&#8217;s just<br />
`loremTEXT.replace(/\r\n/gm, &#8220;\n&#8221;);`<br />
To convert line endings from Windows style to Unix style.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bounce</title>
		<link>http://blog.flexexamples.com/2008/12/16/replacing-carriage-returns-and-line-feeds-with-newline-characters-using-regular-expressions/comment-page-1/#comment-4060</link>
		<dc:creator>Bounce</dc:creator>
		<pubDate>Thu, 05 Feb 2009 18:40:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/12/16/replacing-carriage-returns-and-line-feeds-with-newline-characters-using-regular-expressions/#comment-4060</guid>
		<description>Brilliant !

Just what i needed.

cheers man.
B.</description>
		<content:encoded><![CDATA[<p>Brilliant !</p>
<p>Just what i needed.</p>
<p>cheers man.<br />
B.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter deHaan</title>
		<link>http://blog.flexexamples.com/2008/12/16/replacing-carriage-returns-and-line-feeds-with-newline-characters-using-regular-expressions/comment-page-1/#comment-4054</link>
		<dc:creator>Peter deHaan</dc:creator>
		<pubDate>Wed, 17 Dec 2008 22:51:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/12/16/replacing-carriage-returns-and-line-feeds-with-newline-characters-using-regular-expressions/#comment-4054</guid>
		<description>speps,

Great tip, thanks!
That&#039;s a much better solution than my temporary RegExp object.

Peter</description>
		<content:encoded><![CDATA[<p>speps,</p>
<p>Great tip, thanks!<br />
That&#8217;s a much better solution than my temporary RegExp object.</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: speps</title>
		<link>http://blog.flexexamples.com/2008/12/16/replacing-carriage-returns-and-line-feeds-with-newline-characters-using-regular-expressions/comment-page-1/#comment-4055</link>
		<dc:creator>speps</dc:creator>
		<pubDate>Wed, 17 Dec 2008 22:40:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/12/16/replacing-carriage-returns-and-line-feeds-with-newline-characters-using-regular-expressions/#comment-4055</guid>
		<description>&lt;pre class=&quot;code&quot;&gt;
loremTEXT2 = loremTEXT.replace(/[\\r\\n]/g, &quot;\\n&quot;);
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<pre class="code">
loremTEXT2 = loremTEXT.replace(/[\\r\\n]/g, "\\n");
</pre>
]]></content:encoded>
	</item>
</channel>
</rss>

