Converting Straight Quotes to Curly Quotes

Posted by BlueVoid on Stack Overflow See other posts from Stack Overflow or by BlueVoid
Published on 2010-02-04T20:09:57Z Indexed on 2010/03/25 4:33 UTC
Read the original article Hit count: 494

Filed under:
|

I have an application which uses a javascript based rules engine. I need a way to convert regular straight quotes into curl (or smart) quotes. It'd be easy to just do a string.replace for ["], only this will only insert one case of the curly quote.

The best way I could think of was replace the first occurrence of a quote with a left curly quote and every other one following with a left, and the rest right curly.

Is there a way to accomplish this using javascript?

© Stack Overflow or respective owner

Related posts about regex

Related posts about JavaScript