How do I remove emoji from string

前端 未结 10 2222
你的背包
你的背包 2020-11-28 10:44

My problem is to remove emoji from a string, but not CJK (Chinese, Japanese, Korean) characters from a string using regex. I tried to use this regex:

REGEX =         


        
10条回答
  •  南笙
    南笙 (楼主)
    2020-11-28 11:21

    Instead of removing Emoji characters, you can only include alphabets and numbers. A simple tr should do the trick, .tr('^A-Za-z0-9', ''). Of course this will remove all punctuation, but you can always modify the regex to suit your specific condition.

提交回复
热议问题