How to replace curly quotation marks in a string using Javascript?

前端 未结 3 480
挽巷
挽巷 2020-12-05 07:02

I am trying to replace curly quotes:

str = \'“I don’t know what you mean by ‘glory,’ ” Alice said.\';

Using:

str.replace(/[         


        
3条回答
  •  无人及你
    2020-12-05 08:07

    There is now a library called 'SmartQuotes' that will correctly do the job of replacing standard coder's quotes/apostrophes with pretty, typographer's smart quotes -- better than using a simpler search-and-replace as it gets the opening/closing correct.

提交回复
热议问题