I need to convert strings pasted into a text area so that, if they were pasted from MS Word, the weird quotation marks and apostrophes that Word likes to use will get converted to regular single and double quotes. Unfortunately my text editor seems to already convert such quotes when I save, so any regular expression I make seems to get messed up. So something like this
string = string.replace(new RegExp("“", "g"), '"').replace(new RegExp("”", "g"), '"').replace(new RegExp("’", "g"), "'");
doesn't seem to work. (and I don't even know if it will post correctly here)
How do I construct the regular expression to find these quotation marks using all "regular" characters? Presumably an escape sequence? I prefer avoid the RegExp "literal" notation, even if creating objects is slower.