我想確定我的矢量的元素包含的表情符號:如何將表情符號與R正則表達式匹配?
x = c('', 'no', '', '', 'no', '', '䨺', '감사')
x
# [1] "\U0001f602" "no" "\U0001f379" "\U0001f600" "no" "\U0001f61b" "䨺" "감사"
相關職位只包括其他語言,因爲他們大多是指專業圖書館,我無法想出一個辦法來轉換爲R:
- What is the regex to extract all the emojis from a string?
- How do I remove emoji from string
- replace emoji unicode symbol using regexp in javascript
- Regular expression matching emoji in Mac OS X/iOS
- remove unicode emoji using re in python
第二個看起來非常有前途的,但很可惜(不提供perl = TRUE
固定):
x[grepl('[\u{1F600}-\u{1F6FF}]', x)]
Error: invalid \u{xxxx} sequence (line 1)
類似的問題與其他問題來的。我們如何在R中匹配表情符號?
資本U? (3去) – SymbolixAU
@SymbolixAU哦,我的!那麼這是令人尷尬的orz – MichaelChirico
你還想要縮小範圍來捕捉'飲料'表情符號:) – SymbolixAU