<?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: Remove special characters (like !, &gt;, ?, ., # etc.,) from a string using JavaScript</title> <atom:link href="http://www.developersnippets.com/2007/05/12/remove-special-characters-like-etc-from-a-string-using-javascript/feed/" rel="self" type="application/rss+xml" /><link>http://www.developersnippets.com/2007/05/12/remove-special-characters-like-etc-from-a-string-using-javascript/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=remove-special-characters-like-etc-from-a-string-using-javascript</link> <description>An Embodiment for Developers</description> <lastBuildDate>Wed, 01 Feb 2012 15:41:17 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: THe one</title><link>http://www.developersnippets.com/2007/05/12/remove-special-characters-like-etc-from-a-string-using-javascript/comment-page-1/#comment-4812</link> <dc:creator>THe one</dc:creator> <pubDate>Wed, 14 Sep 2011 16:21:46 +0000</pubDate> <guid isPermaLink="false">http://www.developersnippets.com/?p=13#comment-4812</guid> <description>was looking for this. Works great. Thx!</description> <content:encoded><![CDATA[<p>was looking for this. Works great. Thx!</p> ]]></content:encoded> </item> <item><title>By: Jake</title><link>http://www.developersnippets.com/2007/05/12/remove-special-characters-like-etc-from-a-string-using-javascript/comment-page-1/#comment-4747</link> <dc:creator>Jake</dc:creator> <pubDate>Thu, 23 Jun 2011 06:34:31 +0000</pubDate> <guid isPermaLink="false">http://www.developersnippets.com/?p=13#comment-4747</guid> <description>This helped me in writing an HP WebOS app in which a method returns a version number of the application(such as 1.1.9), but this script allowed me to change that to 119. Thanks!!!</description> <content:encoded><![CDATA[<p>This helped me in writing an HP WebOS app in which a method returns a version number of the application(such as 1.1.9), but this script allowed me to change that to 119. Thanks!!!</p> ]]></content:encoded> </item> <item><title>By: maneesh sharma</title><link>http://www.developersnippets.com/2007/05/12/remove-special-characters-like-etc-from-a-string-using-javascript/comment-page-1/#comment-4693</link> <dc:creator>maneesh sharma</dc:creator> <pubDate>Wed, 04 May 2011 07:49:20 +0000</pubDate> <guid isPermaLink="false">http://www.developersnippets.com/?p=13#comment-4693</guid> <description>Thanks for this code:temp =  temp.replace(/[^a-zA-Z 0-9]+/g,&#039;&#039;);</description> <content:encoded><![CDATA[<p>Thanks for this code:temp =  temp.replace(/[^a-zA-Z 0-9]+/g,&#8221;);</p> ]]></content:encoded> </item> <item><title>By: Remove Special Characters</title><link>http://www.developersnippets.com/2007/05/12/remove-special-characters-like-etc-from-a-string-using-javascript/comment-page-1/#comment-3831</link> <dc:creator>Remove Special Characters</dc:creator> <pubDate>Fri, 12 Nov 2010 10:00:07 +0000</pubDate> <guid isPermaLink="false">http://www.developersnippets.com/?p=13#comment-3831</guid> <description>public class MyClass5 { public static String removeSP(String text) { int length = text.length(); StringBuffer buffer = new StringBuffer(length); for(int i = 0; i &gt;7)==0 &amp;&amp; (Character.isDigit(ch)&#124;&#124;Character.isLetter(ch))){ buffer.append(ch); } } System.out.println(&quot;--------rv----------&quot;+buffer.toString()); return buffer.toString(); } public static void main(String[] args) { MyClass5 m=new MyClass5(); String s=&quot;BayernMüµäånchen€¥ÆAmateþure1234567890@///\\\\&#039;:&#039;\&quot;#$!^&amp;*&gt;,&lt;÷&#039;{}()_-+=&quot;; m.removeSP(s); } }</description> <content:encoded><![CDATA[<p>public class MyClass5 {<br /> public static String removeSP(String text) {<br /> int length = text.length();<br /> StringBuffer buffer = new StringBuffer(length);<br /> for(int i = 0; i &gt;7)==0 &amp;&amp; (Character.isDigit(ch)||Character.isLetter(ch))){<br /> buffer.append(ch);</p><p> }<br /> }</p><p> System.out.println(&#8220;&#8212;&#8212;&#8211;rv&#8212;&#8212;&#8212;-&#8221;+buffer.toString());<br /> return buffer.toString();<br /> }</p><p> public static void main(String[] args) {<br /> MyClass5 m=new MyClass5();<br /> String s=&#8221;BayernMüµäånchen€¥ÆAmateþure1234567890@///\\\\&#8217;:'\&#8221;#$!^&amp;*&gt;,&lt;÷&#039;{}()_-+=&quot;;<br /> m.removeSP(s);</p><p> }<br /> }</p> ]]></content:encoded> </item> <item><title>By: Nizamudeen's friend</title><link>http://www.developersnippets.com/2007/05/12/remove-special-characters-like-etc-from-a-string-using-javascript/comment-page-1/#comment-3140</link> <dc:creator>Nizamudeen's friend</dc:creator> <pubDate>Mon, 05 Apr 2010 22:04:16 +0000</pubDate> <guid isPermaLink="false">http://www.developersnippets.com/?p=13#comment-3140</guid> <description>I also recently discovered a way to do something similar to above (i.e. replace &#039;%&#039; with &#039;D&#039;).As an example, you might want to allow a user to fill in a text area including usage of letters &#039;p&#039;, &#039;m&#039;, &#039;x&#039;, and &#039;d&#039; in place or arithmetic operators &#039;+&#039;, &#039;-&#039;, &#039;*&#039;, and &#039;/&#039;.Note p, m, x, and d are abbreviations for &#039;plus&#039;, &#039;minus&#039;, &#039;times&#039; (x), and &#039;divide&#039;.The reason for this might be to save time when typing numerous short formulas.  (Formulae? anyway...)  So to save from having to use the Shift+&#039;=&#039; (for &#039;+&#039;) and Shift+8 (for &#039;*&#039;), you may type &quot;3p4&quot; for &quot;3+4&quot;, etc.Anyway, so this is reversible as well, but the way to solve it using my example above is with a statement/function similar to this: &#039;+-*/&#039;.charAt(&#039;pmxd&#039;.indexOf(operator)) where &#039;operator&#039; is the p, m x, or d which you have to discover before applying the &quot;search &amp; replace&quot;-like function...You&#039;d probably need to use regexp&#039;s with match/search/replace if you needed to do the same with something that had char.length of greater than one...</description> <content:encoded><![CDATA[<p>I also recently discovered a way to do something similar to above (i.e. replace &#8216;%&#8217; with &#8216;D&#8217;).</p><p>As an example, you might want to allow a user to fill in a text area including usage of letters &#8216;p&#8217;, &#8216;m&#8217;, &#8216;x&#8217;, and &#8216;d&#8217; in place or arithmetic operators &#8216;+&#8217;, &#8216;-&#8217;, &#8216;*&#8217;, and &#8216;/&#8217;.</p><p>Note p, m, x, and d are abbreviations for &#8216;plus&#8217;, &#8216;minus&#8217;, &#8216;times&#8217; (x), and &#8216;divide&#8217;.</p><p>The reason for this might be to save time when typing numerous short formulas.  (Formulae? anyway&#8230;)  So to save from having to use the Shift+&#8217;=&#8217; (for &#8216;+&#8217;) and Shift+8 (for &#8216;*&#8217;), you may type &#8220;3p4&#8243; for &#8220;3+4&#8243;, etc.</p><p>Anyway, so this is reversible as well, but the way to solve it using my example above is with a statement/function similar to this:<br /> &#8216;+-*/&#8217;.charAt(&#8216;pmxd&#8217;.indexOf(operator))<br /> where &#8216;operator&#8217; is the p, m x, or d which you have to discover before applying the &#8220;search &amp; replace&#8221;-like function&#8230;</p><p>You&#8217;d probably need to use regexp&#8217;s with match/search/replace if you needed to do the same with something that had char.length of greater than one&#8230;</p> ]]></content:encoded> </item> <item><title>By: Nizamudeen's friend</title><link>http://www.developersnippets.com/2007/05/12/remove-special-characters-like-etc-from-a-string-using-javascript/comment-page-1/#comment-3139</link> <dc:creator>Nizamudeen's friend</dc:creator> <pubDate>Mon, 05 Apr 2010 21:49:02 +0000</pubDate> <guid isPermaLink="false">http://www.developersnippets.com/?p=13#comment-3139</guid> <description>@Nizamudeen,[code] &#039;abc%efg&#039;.replace(/%/gi,&#039;D&#039;) [/code]should work.</description> <content:encoded><![CDATA[<p>@Nizamudeen,</p><p>[code]<br /> 'abc%efg'.replace(/%/gi,'D')<br /> [/code]</p><p>should work.</p> ]]></content:encoded> </item> <item><title>By: Ultmast</title><link>http://www.developersnippets.com/2007/05/12/remove-special-characters-like-etc-from-a-string-using-javascript/comment-page-1/#comment-2815</link> <dc:creator>Ultmast</dc:creator> <pubDate>Tue, 12 Jan 2010 00:23:44 +0000</pubDate> <guid isPermaLink="false">http://www.developersnippets.com/?p=13#comment-2815</guid> <description>@Jayakrishnan Some of those characters need to be escaped.</description> <content:encoded><![CDATA[<p>@Jayakrishnan Some of those characters need to be escaped.</p> ]]></content:encoded> </item> <item><title>By: Jayakrishnan</title><link>http://www.developersnippets.com/2007/05/12/remove-special-characters-like-etc-from-a-string-using-javascript/comment-page-1/#comment-2583</link> <dc:creator>Jayakrishnan</dc:creator> <pubDate>Fri, 16 Oct 2009 05:48:27 +0000</pubDate> <guid isPermaLink="false">http://www.developersnippets.com/?p=13#comment-2583</guid> <description>i have a search string and i nedd to get rid off the characters -,?~!@#$%&amp;*+-=&quot;&#039; i tried using the regular expression /[-,?~!@#$%&amp;*+-=&quot;&#039;]/g i&#039;m using jQuery my code is var queryString = $(&quot;#searchq&quot;).val(); queryString = queryString.replace(/[-,?~!@#$%&amp;*+-=&quot;&#039;]/g,&#039;&#039;); $(&quot;#searchq&quot;).val(queryString); but unfortunately after using this it can be seen that even the digits get replaced. also . gets replaced. whats wrong with my regular expresion</description> <content:encoded><![CDATA[<p>i have a search string and i nedd to get rid off the characters -,?~!@#$%&amp;*+-=&#8221;&#8216;<br /> i tried using the regular expression /[-,?~!@#$%&amp;*+-="']/g<br /> i&#8217;m using jQuery<br /> my code is<br /> var queryString = $(&#8220;#searchq&#8221;).val();<br /> queryString = queryString.replace(/[-,?~!@#$%&amp;*+-="']/g,&#8221;);<br /> $(&#8220;#searchq&#8221;).val(queryString);<br /> but unfortunately after using this it can be seen that even the digits get replaced.<br /> also . gets replaced. whats wrong with my regular expresion</p> ]]></content:encoded> </item> <item><title>By: Nizamudeen</title><link>http://www.developersnippets.com/2007/05/12/remove-special-characters-like-etc-from-a-string-using-javascript/comment-page-1/#comment-2540</link> <dc:creator>Nizamudeen</dc:creator> <pubDate>Wed, 07 Oct 2009 07:51:28 +0000</pubDate> <guid isPermaLink="false">http://www.developersnippets.com/?p=13#comment-2540</guid> <description>I have a string &quot;abc%ef&quot;,i need to replace % to d by using replace function in javascript.how to do this.</description> <content:encoded><![CDATA[<p>I have a string &#8220;abc%ef&#8221;,</p><p>i need to replace % to d by using replace function in javascript.</p><p>how to do this.</p> ]]></content:encoded> </item> <item><title>By: Remove special characters on value change. &#124; MSCRM Blogger</title><link>http://www.developersnippets.com/2007/05/12/remove-special-characters-like-etc-from-a-string-using-javascript/comment-page-1/#comment-2513</link> <dc:creator>Remove special characters on value change. &#124; MSCRM Blogger</dc:creator> <pubDate>Thu, 01 Oct 2009 15:02:27 +0000</pubDate> <guid isPermaLink="false">http://www.developersnippets.com/?p=13#comment-2513</guid> <description>[...] This blog entry contains some helpful information about removing special characters from a string using javascript. I was able to modify it to be just a few of code in an onchange event. Just rename new_name to the attribute your correcting. [...]</description> <content:encoded><![CDATA[<p>[...] This blog entry contains some helpful information about removing special characters from a string using javascript. I was able to modify it to be just a few of code in an onchange event. Just rename new_name to the attribute your correcting. [...]</p> ]]></content:encoded> </item> <item><title>By: jaywink</title><link>http://www.developersnippets.com/2007/05/12/remove-special-characters-like-etc-from-a-string-using-javascript/comment-page-1/#comment-2426</link> <dc:creator>jaywink</dc:creator> <pubDate>Sat, 05 Sep 2009 12:29:07 +0000</pubDate> <guid isPermaLink="false">http://www.developersnippets.com/?p=13#comment-2426</guid> <description>Great tip thanks!</description> <content:encoded><![CDATA[<p>Great tip thanks!</p> ]]></content:encoded> </item> <item><title>By: admin</title><link>http://www.developersnippets.com/2007/05/12/remove-special-characters-like-etc-from-a-string-using-javascript/comment-page-1/#comment-2161</link> <dc:creator>admin</dc:creator> <pubDate>Fri, 24 Jul 2009 18:07:00 +0000</pubDate> <guid isPermaLink="false">http://www.developersnippets.com/?p=13#comment-2161</guid> <description>Hi Raju,Thanks a lot.... :)Thanks, Vivek</description> <content:encoded><![CDATA[<p>Hi Raju,</p><p>Thanks a lot&#8230;. <img src='http://www.developersnippets.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>Thanks,<br /> Vivek</p> ]]></content:encoded> </item> <item><title>By: Raju Samuel</title><link>http://www.developersnippets.com/2007/05/12/remove-special-characters-like-etc-from-a-string-using-javascript/comment-page-1/#comment-2159</link> <dc:creator>Raju Samuel</dc:creator> <pubDate>Fri, 24 Jul 2009 09:05:22 +0000</pubDate> <guid isPermaLink="false">http://www.developersnippets.com/?p=13#comment-2159</guid> <description>Thankx buddy.. This has saved a lot of time.. God bless</description> <content:encoded><![CDATA[<p>Thankx buddy..<br /> This has saved a lot of time..<br /> God bless</p> ]]></content:encoded> </item> <item><title>By: Cathy</title><link>http://www.developersnippets.com/2007/05/12/remove-special-characters-like-etc-from-a-string-using-javascript/comment-page-1/#comment-2141</link> <dc:creator>Cathy</dc:creator> <pubDate>Thu, 16 Jul 2009 05:32:00 +0000</pubDate> <guid isPermaLink="false">http://www.developersnippets.com/?p=13#comment-2141</guid> <description>Thanks! It worked!</description> <content:encoded><![CDATA[<p>Thanks! It worked!</p> ]]></content:encoded> </item> <item><title>By: phwebdevelopers</title><link>http://www.developersnippets.com/2007/05/12/remove-special-characters-like-etc-from-a-string-using-javascript/comment-page-1/#comment-2115</link> <dc:creator>phwebdevelopers</dc:creator> <pubDate>Wed, 08 Jul 2009 02:15:36 +0000</pubDate> <guid isPermaLink="false">http://www.developersnippets.com/?p=13#comment-2115</guid> <description>Thatsits really worked.i needed it to remove javascript errors</description> <content:encoded><![CDATA[<p>Thats</p><p>its really worked.</p><p>i needed it to remove javascript errors</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
Database Caching using disk: basic
Object Caching 518/520 objects using disk: basic

Served from: www.developersnippets.com @ 2012-02-07 17:19:32 -->
