<?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/"
xmlns:series="http://unfoldingneurons.com/"
> <channel><title>Comments on: Replace All Occurrences of a String in&#160;JavaScript</title> <atom:link href="http://davidwalsh.name/javascript-replace/feed" rel="self" type="application/rss+xml" /><link>http://davidwalsh.name/javascript-replace</link> <description>Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</description> <lastBuildDate>Wed, 23 May 2012 04:02:29 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>By: gadget</title><link>http://davidwalsh.name/javascript-replace#comment-31623</link> <dc:creator>gadget</dc:creator> <pubDate>Sun, 15 Apr 2012 08:51:57 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3639#comment-31623</guid> <description>Here is another article about javascript replace you people might be interested @http://gadgets-code.com/javascript-replace-method-review:)</description> <content:encoded><![CDATA[<p>Here is another article about javascript replace you people might be interested @</p><p><a
href="http://gadgets-code.com/javascript-replace-method-review" rel="nofollow">http://gadgets-code.com/javascript-replace-method-review</a></p><p>:)</p> ]]></content:encoded> </item> <item><title>By: Magento定制</title><link>http://davidwalsh.name/javascript-replace#comment-26411</link> <dc:creator>Magento定制</dc:creator> <pubDate>Mon, 08 Aug 2011 21:27:18 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3639#comment-26411</guid> <description>also have this problem. thanks for your perfect method.
I use replace(/\+/g, &#039; &#039;)  replace &quot;+&quot; to space</description> <content:encoded><![CDATA[<p>also have this problem. thanks for your perfect method.<br
/> I use replace(/\+/g, &#8216; &#8216;)  replace &#8220;+&#8221; to space</p> ]]></content:encoded> </item> <item><title>By: Yang</title><link>http://davidwalsh.name/javascript-replace#comment-24171</link> <dc:creator>Yang</dc:creator> <pubDate>Tue, 24 May 2011 02:32:24 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3639#comment-24171</guid> <description>Could you tell me what is code to create the copy to clipboard button, please?</description> <content:encoded><![CDATA[<p>Could you tell me what is code to create the copy to clipboard button, please?</p> ]]></content:encoded> </item> <item><title>By: elron</title><link>http://davidwalsh.name/javascript-replace#comment-17449</link> <dc:creator>elron</dc:creator> <pubDate>Thu, 06 May 2010 21:59:46 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3639#comment-17449</guid> <description>can it replace the page itself?
i mean, insted of &quot;&lt;b&gt;&quot;, it will write &quot;&lt;strong&gt;&quot;,
or insted if &quot;&lt;iframe&gt;&quot;, it will write &quot;&quot; (&quot;&lt;&quot; is &quot;&lt;&quot;)
waiting for a response.
thanks!</description> <content:encoded><![CDATA[<p>can it replace the page itself?<br
/> i mean, insted of &#8220;<b>&#8220;, it will write &#8220;<strong>&#8220;,<br
/> or insted if &#8220;&lt;iframe&gt;&#8221;, it will write &#8220;&#8221; (&#8220;&lt;&#8221; is &#8220;&lt;&quot;)<br
/> waiting for a response.<br
/> thanks!</strong></b></p> ]]></content:encoded> </item> <item><title>By: vrS</title><link>http://davidwalsh.name/javascript-replace#comment-12028</link> <dc:creator>vrS</dc:creator> <pubDate>Mon, 21 Sep 2009 03:35:26 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3639#comment-12028</guid> <description>David, just a question, whats the name of comments system that you had? WDC or something like that. Thx</description> <content:encoded><![CDATA[<p>David, just a question, whats the name of comments system that you had? WDC or something like that. Thx</p> ]]></content:encoded> </item> <item><title>By: James</title><link>http://davidwalsh.name/javascript-replace#comment-11903</link> <dc:creator>James</dc:creator> <pubDate>Tue, 15 Sep 2009 21:04:19 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3639#comment-11903</guid> <description>&quot;.replace is a regular expression replacement method&quot; (@Jay)I think that&#039;s quite misleading. From what you&#039;ve said one would assume that the replace-method&#039;s first argument is converted to a regular expression implicitly when in fact, if you pass a string, it&#039;s treated as literal text and is not converted to a RegExp object.Also, just to clarify, /regex/ is the same as RegExp(&#039;regex&#039;) - which, btw, doesn&#039;t require the new operator.</description> <content:encoded><![CDATA[<p>&#8220;.replace is a regular expression replacement method&#8221; (@Jay)</p><p>I think that&#8217;s quite misleading. From what you&#8217;ve said one would assume that the replace-method&#8217;s first argument is converted to a regular expression implicitly when in fact, if you pass a string, it&#8217;s treated as literal text and is not converted to a RegExp object.</p><p>Also, just to clarify, /regex/ is the same as RegExp(&#8216;regex&#8217;) &#8211; which, btw, doesn&#8217;t require the new operator.</p> ]]></content:encoded> </item> <item><title>By: Jay</title><link>http://davidwalsh.name/javascript-replace#comment-11893</link> <dc:creator>Jay</dc:creator> <pubDate>Tue, 15 Sep 2009 16:06:49 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3639#comment-11893</guid> <description>FTR, JS&#039;s replace function DOES act like replace functions in other languages, just perhaps not the ones you&#039;re expecting it to.It doesn&#039;t work like str&#095;replace in PHP, but it is very similar to preg&#095;replace.As long as developers are aware that .replace is a regular expression replacement method, I think it&#039;s pretty straightforward.http://www.w3schools.com/jsref/jsref&#095;replace.aspIt should also be noted that one can create a regular expression using something like:var regex = new RegExp(&#039;MooTools&#039;, &#039;g&#039;);And that regular expression can be used in the replace function (first parameter).  Which is helpful if you ever want to use the contents of a variable in your replacement:http://tommcfarlin.com/2008/03/11/using-local-variables-with-javascripts-replace-function/Don&#039;t forget to escape!</description> <content:encoded><![CDATA[<p>FTR, JS&#8217;s replace function DOES act like replace functions in other languages, just perhaps not the ones you&#8217;re expecting it to.</p><p>It doesn&#8217;t work like str&#95;replace in PHP, but it is very similar to preg&#95;replace.</p><p>As long as developers are aware that .replace is a regular expression replacement method, I think it&#8217;s pretty straightforward.</p><p><a
href="http://www.w3schools.com/jsref/jsref&#095;replace.asp" rel="nofollow">http://www.w3schools.com/jsref/jsref&#095;replace.asp</a></p><p>It should also be noted that one can create a regular expression using something like:</p><p>var regex = new RegExp(&#8216;MooTools&#8217;, &#8216;g&#8217;);</p><p>And that regular expression can be used in the replace function (first parameter).  Which is helpful if you ever want to use the contents of a variable in your replacement:</p><p><a
href="http://tommcfarlin.com/2008/03/11/using-local-variables-with-javascripts-replace-function/" rel="nofollow">http://tommcfarlin.com/2008/03/11/using-local-variables-with-javascripts-replace-function/</a></p><p>Don&#8217;t forget to escape!</p> ]]></content:encoded> </item> <item><title>By: Richard</title><link>http://davidwalsh.name/javascript-replace#comment-11892</link> <dc:creator>Richard</dc:creator> <pubDate>Tue, 15 Sep 2009 15:07:50 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=3639#comment-11892</guid> <description>I had this issue before, didn&#039;t knew the answer was so simple. Out of frusteration I actually used php.js because I couldn&#039;t figure it out. Thnx man.</description> <content:encoded><![CDATA[<p>I had this issue before, didn&#8217;t knew the answer was so simple. Out of frusteration I actually used php.js because I couldn&#8217;t figure it out. Thnx man.</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 3/7 queries in 0.011 seconds using disk: basic
Object Caching 687/687 objects using disk: basic

Served from: davidwalsh.name @ 2012-05-23 04:14:07 -->
