How to remove emoji code using javascript?

后端 未结 12 2188
忘了有多久
忘了有多久 2020-11-27 05:04

How do I remove emoji code using JavaScript? I thought I had taken care of it using the code below, but I still have characters like

12条回答
  •  一整个雨季
    2020-11-27 05:30

    sandre89's answer is good but not perfect. I spent some time on the subject and have a working solution.

    var ranges = [
      '[\u00A0-\u269f]',
      '[\u26A0-\u329f]',
      // The following characters could not be minified correctly
      // if specifed with the ES6 syntax \u{1F400}
      '[

提交回复
热议问题