Replace with javascript (not ')

I have a problem replacing ==> ' (apostrophe) with a space that I know it looks so simple, but I mean that editors don't print an apostrophe like this ==> ' , but like this ==> ' and I can’t find a way to replace it using

 var newtext = old.replace(/'/g,""); 

here is an example http://jsfiddle.net/zYK9f/4/ in this example you can type ==> ' on the page, but you have tried a lot in the code editor, but there is no result, I hope you can help thanks, sorry, I have mind an apostrophe, not a semicolon

+8
javascript regex replace expression
source share
3 answers

I'm not sure what you are asking ... like the other answers, you can use

 var newtext = old.replace(/'|'/g," "); 

However, if the ' character is not allowed in your editor, you can use the unicode equivalent:

 var newtext = old.replace(/\u2019/g," "); 
+5
source share

Just copy and paste the character into the account for both:

 var newtext = old.replace(/'|'/g,""); 
+7
source share
 var old = "you'll keep''' finding more and ''''more ways to use it."; var newtext = old.replace(/'/g,""); var newtext = newtext.replace(/'/g,""); $("#text").html(newtext); 

Get rid of both types of apostrophes. Is this what you want?

+1
source share

All Articles