replace emoji unicode symbol using regexp in javascript

前端 未结 9 988
醉酒成梦
醉酒成梦 2020-12-15 10:42

As you all know emoji symbols are coded up to 3 or 4 bytes, so it may occupy 2 symbols in my string. For example \'

相关标签:
9条回答
  • 2020-12-15 11:15
    1. /\ud83d[\ude00-\ude4f]/g

    not including all emojis like :

    0 讨论(0)
  • 2020-12-15 11:15

    For fun : Solution to remove special characters without using regexp

    const str = "abcdefgehijkz Раз, два три! 1234567809 -ab A Z & é è Ö â                                                                     
    0 讨论(0)
  • 2020-12-15 11:24

    To remove all possible emojis:

    new RegExp('[\u1000-\uFFFF]+', 'g');
    
    0 讨论(0)
提交回复
热议问题