Jump to content

Rich Text Editor and Smart Quotes


Recommended Posts

I received the following code from my BRM to replace standard quotation marks with Smart Quotes in a form field using the Rich Text Editor.


field = field.replace(/(\<)(.+)(\>)/g, function(m,p1,p2,p3){return p1 + p2.replace(/\"/g, "\|") + p3;});
field = field.replace(/"([^"]*)"/g, "“$1”").replace(/(\w)'(\w)/g, "$1’$2").replace(/'([^']*)'/g, "‘$1’");
field = field.replace(/\|/g, "\"");
return field;



This code works with the Rich Text Editor for single quotes (aposotrophe), but does not work for double quotes.


Can someone help fix this to work with double quotes?


See the PDF using the link below to see the working single quotes, but not double quotes.





Link to comment
Share on other sites

  • Create New...