如何使用 javascript 检测表情符号

Posted

技术标签:

【中文标题】如何使用 javascript 检测表情符号【英文标题】:How to detect emoji using javascript 【发布时间】:2013-09-18 01:02:14 【问题描述】:

我需要有关如何检测输入是否包含日语表情符号/表情符号的帮助。

目前我的字符集是charset=utf-8。在输入文本时,用户可以输入日文字符/字母数字/符号,但如果他们插入表情符号,onsubmit javascript 将检查是否有表情符号,并显示错误消息。

我无法让它工作,因为我不知道如何在 JavaScript 中检测表情符号?

【问题讨论】:

【参考方案1】:

答案可能有效,但很糟糕,因为它们依赖于不可读且有点“神奇”的 unicode 范围,因为它们来自哪里以及它们为什么工作并不总是很清楚,更不用说它们对新的表情符号没有弹性正在添加到规范中。

主要浏览器现在支持unicode property escape,它允许根据它们在Emoji unicode 类别中的归属来匹配表情符号:\pEmoji 匹配一个表情符号,\PEmoji 匹配一个非表情符号。

请注意officially、0123456789#* 和其他字符也是表情符号,因此您可能要使用的属性转义不是Emoji,而是Extended_Pictographic,它表示所有通常被理解为表情符号的字符!

确保在末尾包含the u flag。

console.log(
  /\pEmoji/u.test('flowers'), // false :)
  /\pEmoji/u.test('flowers ???'), // true :)
  /\pEmoji/u.test('flowers 123'), // true :( 
)
console.log(
  /\pExtended_Pictographic/u.test('flowers'), // false :)
  /\pExtended_Pictographic/u.test('flowers ???'), // true :)
  /\pExtended_Pictographic/u.test('flowers 123'), // false :)
)

这可以很好地检测表情符号,但是如果您想使用相同的正则表达式来提取它们,您可能会对它的行为感到惊讶,因为某些表情符号出现因为一个字符实际上是几个字符。它们就是我们所说的表情符号序列,更多关于它们的信息in this question

const regex = /\pExtended_Pictographic/ug
const family = '?‍?‍?' // "family 
console.log(family.length) // not 1, but 8!
console.log(regex.test(family)) // true, as expected
console.log(family.match(regex)) // not [family], but [man, woman, girl]

【讨论】:

这应该是被接受的答案。所有其他正则表达式都不是真正可维护的。 Emoji 类似乎也匹配数字。试试这个:/^\pEmoji*$/u.test("123") 一个解决方法是这个正则表达式:/(?=\pEmoji)(?!\pNumber)/u 啊,谢谢@Bronzdragon!问题更复杂,我问了another question on the subject 并提到了你的修复,并更新了上面的答案,因为你的修复不能处理*# 也是表情符号 这个 一个不错的简单答案,但请注意它不会像您预期的那样解释多部分表情符号。例如:'?‍?‍?'.match(/\pExtended_Pictographic/ug) -> ["?","?","?"] @SimplGy 感谢您了解这个问题!我相应地编辑了我的答案。【参考方案2】:

您可以使用以下正则表达式:

/(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff])2|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|\ud83c[\ude32-\ude3a]|\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])/g

如果你只是想从字符串中删除它,你可以这样做。

function removeEmojis (string) 
  var regex = /(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff])2|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|\ud83c[\ude32-\ude3a]|\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])/g;

  return string.replace(regex, '');

【讨论】:

对我来说很好的答案。然而,正则表达式中的错误会导致它也匹配右括号 ([)。看起来只是复制和粘贴代码的错误,但卢卡斯请修复。此处修复正则表达式:pastebin.com/0VZZKfWf 如何处理添加到规范中的新表情符号? @JamieStreet 你试过了吗?如果它不起作用,很遗憾,正则表达式可能需要调整 +1。我想知道它是否会像***.com/a/20208095/470749的正则表达式一样更新 它适用于此处列出的所有表情符号:getemoji.com【参考方案3】:

您可以使用此库中的正则表达式emoji-regex

【讨论】:

【参考方案4】:

一个简单的函数,如果您的字符串包含一个或多个表情符号,则返回 true

function isEmoji(str) 
    var ranges = [
        '(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff])2|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|[\ud83c[\ude32-\ude3a]|[\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])' // U+1F680 to U+1F6FF
    ];
    if (str.match(ranges.join('|'))) 
        return true;
     else 
        return false;
    

【讨论】:

不匹配 ✈️、❤️ 和 ? 我们如何检测字符串是否真的只有一个表情符号?如果字符串包含表情符号,则返回 true 包含长度为 198 个字符的正则表达式的函数不是 “简单函数”【参考方案5】:

我们可以检测所有代理对列表或特定范围内的表情符号字符。 如果问题与将输入字符串存储到数据库(如 5.5 之前的 mysql 版本)有关,我们需要使用以下正则表达式检测并删除所有代理对

/([\uD800-\uDBFF][\uDC00-\uDFFF])/g.

【讨论】:

它不匹配⚱️和⚰️【参考方案6】:

首先,您不能依赖符合 ECMAScript 2018+ 的 \pEmoji(至少在撰写本文时)。它确实与一些0123456789#* 非表情符号字符匹配(请参阅Nino Filiu's answer)。详情请见Why do Unicode emoji property escapes match numbers?。

要测试 JavaScript 中的字符串中是否有任何表情符号字符,您可以使用以下 ECMAScript 2018+ 兼容解决方案(注意u 标志):

const regex_emoji = /[\pExtended_Pictographic\u1F3FB-\u1F3FF\u1F9B0-\u1F9B3]/u;
console.log( regex_emoji.test('flowers 123') );     // => false
console.log( regex_emoji.test('flowers ???') ); // => true

您甚至可以提取一个或多个 emoji 字符序列 使用此模式(注意添加的 g 标志以查找所有匹配项,+ 匹配字符类的一个或多个连续出现模式):

const regex_emoji = /[\pExtended_Pictographic\u1F3FB-\u1F3FF\u1F9B0-\u1F9B3]+/gu;
console.log( 'flowers 123'.match(regex_emoji) );     // => null
console.log( 'flowers ???'.match(regex_emoji) ); // => [ "???" ]

简而言之,Extended_Pictographic Unicode 类别类匹配大多数表情符号字符,除了一些 Emoji_Components,即浅色皮肤到深色皮肤模式字符 (\u1F3FB-\u1F3FF) 和红发到白发字符 ( \u1F9B0-\u1F9B3)。

要将表情符号计数或提取为单个字符或连续序列的数组(如上面的第二个代码 sn-p 中的较长文本)并对表情符号执行其他操作,您可以使用自定义正则表达式(如Scott Weaver's answer)。使用更长的转义版本更安全。但是,Emoji Keyboard/Display Test Data for UTR #51 (Version: 13.1) 文件中定义了4590 emoji characters。因此,(符合 ES5,甚至在 IE 中也可以使用)regex 来匹配 single emoji char

var EmojiPattern = /[#*0-9]\uFE0F?\u20E3|©\uFE0F?|[®\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA]\uFE0F?|[\u231A\u231B]|[\u2328\u23CF]\uFE0F?|[\u23E9-\u23EC]|[\u23ED-\u23EF]\uFE0F?|\u23F0|[\u23F1\u23F2]\uFE0F?|\u23F3|[\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC]\uFE0F?|[\u25FD\u25FE]|[\u2600-\u2604\u260E\u2611]\uFE0F?|[\u2614\u2615]|\u2618\uFE0F?|\u261D(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642]\uFE0F?|[\u2648-\u2653]|[\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E]\uFE0F?|\u267F|\u2692\uFE0F?|\u2693|[\u2694-\u2697\u2699\u269B\u269C\u26A0]\uFE0F?|\u26A1|\u26A7\uFE0F?|[\u26AA\u26AB]|[\u26B0\u26B1]\uFE0F?|[\u26BD\u26BE\u26C4\u26C5]|\u26C8\uFE0F?|\u26CE|[\u26CF\u26D1\u26D3]\uFE0F?|\u26D4|\u26E9\uFE0F?|\u26EA|[\u26F0\u26F1]\uFE0F?|[\u26F2\u26F3]|\u26F4\uFE0F?|\u26F5|[\u26F7\u26F8]\uFE0F?|\u26F9(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?|\uFE0F(?:\u200D[\u2640\u2642]\uFE0F?)?)?|[\u26FA\u26FD]|\u2702\uFE0F?|\u2705|[\u2708\u2709]\uFE0F?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|\u270F\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DF9F]\uFE0F?|[\uDFA0-\uDFC1]|\uDFC2(?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC3\uDFC4](?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?)?|[\uDFC5\uDFC6]|\uDFC7(?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC8\uDFC9]|\uDFCA(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?)?|[\uDFCB\uDFCC](?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?|\uFE0F(?:\u200D[\u2640\u2642]\uFE0F?)?)?|[\uDFCD\uDFCE]\uFE0F?|[\uDFCF-\uDFD3]|[\uDFD4-\uDFDF]\uFE0F?|[\uDFE0-\uDFF0]|\uDFF3(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08)|\uFE0F(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?)?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?|[\uDFF5\uDFF7]\uFE0F?|[\uDFF8-\uDFFF])|\uD83D(?:[\uDC00-\uDC07]|\uDC08(?:\u200D\u2B1B)?|[\uDC09-\uDC14]|\uDC15(?:\u200D\uD83E\uDDBA)?|[\uDC16-\uDC3A]|\uDC3B(?:\u200D\u2744\uFE0F?)?|[\uDC3C-\uDC3E]|\uDC3F\uFE0F?|\uDC40|\uDC41(?:\u200D\uD83D\uDDE8\uFE0F?|\uFE0F(?:\u200D\uD83D\uDDE8\uFE0F?)?)?|[\uDC42\uDC43](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC44\uDC45]|[\uDC46-\uDC50](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC51-\uDC65]|[\uDC66\uDC67](?:\uD83C[\uDFFB-\uDFFF])?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92])|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF-\uDDB3\uDDBC\uDDBD])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF-\uDDB3\uDDBC\uDDBD])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF-\uDDB3\uDDBC\uDDBD])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF-\uDDB3\uDDBC\uDDBD])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF-\uDDB3\uDDBC\uDDBD])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92])|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFF]|\uDC8B\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|[\uDDAF-\uDDB3\uDDBC\uDDBD])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFF]|\uDC8B\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF-\uDDB3\uDDBC\uDDBD])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFF]|\uDC8B\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF-\uDDB3\uDDBC\uDDBD])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFF]|\uDC8B\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF-\uDDB3\uDDBC\uDDBD])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFF]|\uDC8B\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|[\uDDAF-\uDDB3\uDDBC\uDDBD])))?))?|\uDC6A|[\uDC6B-\uDC6D](?:\uD83C[\uDFFB-\uDFFF])?|\uDC6E(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?)?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDC70\uDC71](?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?)?|\uDC72(?:\uD83C[\uDFFB-\uDFFF])?|\uDC73(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?)?|[\uDC74-\uDC76](?:\uD83C[\uDFFB-\uDFFF])?|\uDC77(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?)?|\uDC78(?:\uD83C[\uDFFB-\uDFFF])?|[\uDC79-\uDC7B]|\uDC7C(?:\uD83C[\uDFFB-\uDFFF])?|[\uDC7D-\uDC80]|[\uDC81\uDC82](?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?)?|\uDC83(?:\uD83C[\uDFFB-\uDFFF])?|\uDC84|\uDC85(?:\uD83C[\uDFFB-\uDFFF])?|[\uDC86\uDC87](?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?)?|[\uDC88-\uDC8E]|\uDC8F(?:\uD83C[\uDFFB-\uDFFF])?|\uDC90|\uDC91(?:\uD83C[\uDFFB-\uDFFF])?|[\uDC92-\uDCA9]|\uDCAA(?:\uD83C[\uDFFB-\uDFFF])?|[\uDCAB-\uDCFC]|\uDCFD\uFE0F?|[\uDCFF-\uDD3D]|[\uDD49\uDD4A]\uFE0F?|[\uDD4B-\uDD4E\uDD50-\uDD67]|[\uDD6F\uDD70\uDD73]\uFE0F?|\uDD74(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|\uDD75(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?|\uFE0F(?:\u200D[\u2640\u2642]\uFE0F?)?)?|[\uDD76-\uDD79]\uFE0F?|\uDD7A(?:\uD83C[\uDFFB-\uDFFF])?|[\uDD87\uDD8A-\uDD8D]\uFE0F?|\uDD90(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDD95\uDD96](?:\uD83C[\uDFFB-\uDFFF])?|\uDDA4|[\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA]\uFE0F?|[\uDDFB-\uDE2D]|\uDE2E(?:\u200D\uD83D\uDCA8)?|[\uDE2F-\uDE34]|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|[\uDE37-\uDE44]|[\uDE45-\uDE47](?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?)?|[\uDE48-\uDE4A]|\uDE4B(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?)?|\uDE4C(?:\uD83C[\uDFFB-\uDFFF])?|[\uDE4D\uDE4E](?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?)?|\uDE4F(?:\uD83C[\uDFFB-\uDFFF])?|[\uDE80-\uDEA2]|\uDEA3(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?)?|[\uDEA4-\uDEB3]|[\uDEB4-\uDEB6](?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?)?|[\uDEB7-\uDEBF]|\uDEC0(?:\uD83C[\uDFFB-\uDFFF])?|[\uDEC1-\uDEC5]|\uDECB\uFE0F?|\uDECC(?:\uD83C[\uDFFB-\uDFFF])?|[\uDECD-\uDECF]\uFE0F?|[\uDED0-\uDED2\uDED5-\uDED7]|[\uDEE0-\uDEE5\uDEE9]\uFE0F?|[\uDEEB\uDEEC]|[\uDEF0\uDEF3]\uFE0F?|[\uDEF4-\uDEFC\uDFE0-\uDFEB])|\uD83E(?:\uDD0C(?:\uD83C[\uDFFB-\uDFFF])?|[\uDD0D\uDD0E]|\uDD0F(?:\uD83C[\uDFFB-\uDFFF])?|[\uDD10-\uDD17]|[\uDD18-\uDD1C](?:\uD83C[\uDFFB-\uDFFF])?|\uDD1D|[\uDD1E\uDD1F](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD20-\uDD25]|\uDD26(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?)?|[\uDD27-\uDD2F]|[\uDD30-\uDD34](?:\uD83C[\uDFFB-\uDFFF])?|\uDD35(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?)?|\uDD36(?:\uD83C[\uDFFB-\uDFFF])?|[\uDD37-\uDD39](?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?)?|\uDD3A|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD3D\uDD3E](?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?)?|[\uDD3F-\uDD45\uDD47-\uDD76]|\uDD77(?:\uD83C[\uDFFB-\uDFFF])?|[\uDD78\uDD7A-\uDDB4]|[\uDDB5\uDDB6](?:\uD83C[\uDFFB-\uDFFF])?|\uDDB7|[\uDDB8\uDDB9](?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?)?|\uDDBA|\uDDBB(?:\uD83C[\uDFFB-\uDFFF])?|[\uDDBC-\uDDCB]|[\uDDCD-\uDDCF](?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?)?|\uDDD0|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:\uDD1D\u200D\uD83E\uDDD1|[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|[\uDDAF-\uDDB3\uDDBC\uDDBD])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|[\uDDAF-\uDDB3\uDDBC\uDDBD])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|[\uDDAF-\uDDB3\uDDBC\uDDBD])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|[\uDDAF-\uDDB3\uDDBC\uDDBD])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|[\uDDAF-\uDDB3\uDDBC\uDDBD])))?))?|[\uDDD2\uDDD3](?:\uD83C[\uDFFB-\uDFFF])?|\uDDD4(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?)?|\uDDD5(?:\uD83C[\uDFFB-\uDFFF])?|[\uDDD6-\uDDDD](?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF](?:\u200D[\u2640\u2642]\uFE0F?)?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])/g;

请参阅regex demo。末尾的g 标志意味着此正则表达式可以匹配输入字符串中的所有匹配项。

模式是从表情符号列表中动态创建的,并使用正则表达式树进行收缩。

Here is the ES6+ compliant single emoji pattern(允许\uXXXXX 表示法),但它有点长。

查看这个 JavaScript 演示:

var text = 'flowers ???';
// Detecting if there is at least one emoji
console.log( emoji_detection_regex.test(text) );             // => true
// Counting emojis
console.log( (text.match(emoji_count_regex) || []).length ); // => 3
// Extracting one by one, single emoji array
console.log( text.match(emoji_count_regex) );                // => ["?","?","?"]
// Extracting emoji sequences
console.log( text.match(emoji_extract_or_remove_regex) );    // => ["???"]
// Removing emojis
console.log( text.replace(emoji_extract_or_remove_regex, '') ); // => 'flowers '
<script src="https://gitcdn.link/repo/stribizhev/Emojis/main/ws_emoji_regex.js"></script>

https://github.com/stribizhev/Emojis/blob/main/ws_emoji_regex.js 文件中提供了表情符号正则表达式声明。

【讨论】:

【参考方案7】:

2020 年更新:其中许多模式无法正确匹配复合表情符号或修饰符序列,或者只是过时且与较新的表情符号不匹配。

想想这对接吻的情侣:??‍❤️‍?‍??。它实际上是 6 个(也许更多)其他表情符号与 ZWJ 零宽度连接器粘合在一起。要正确匹配,您必须实际匹配该序列

因此,通过首先匹配较长的序列,这种蛮力模式 (太长太粘贴,但它是一个简单的替换并且运行速度很快) 正确解析了截至 2021 年 5 月的所有 3521 个组合表情符号:

GitHub 链接:https://github.com/sweaver2112/Regex-combined-emojis

2021 年 5 月 10 日编辑:如果这个正则表达式的大小让你反感,你实际上可以跳过 Unicode 转义序列,只使用文字表情符号,从而节省 的空间......嗯,差不多。这个以星号开头的字符“*️⃣”会抛出“nothing to quantify”错误。摆脱这个家伙会产生一个更短的、仍在工作的、复制/粘贴的正​​则表达式,目前匹配 3,520/3,521 个表情符号:

(?:??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|??‍❤️‍?‍??|???????|???????|???????|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍?‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|??‍❤️‍??|?‍❤️‍?‍?|?‍❤️‍?‍?|?‍❤️‍?‍?|?‍?‍?‍?|?‍?‍?‍?|?‍?‍?‍?|?‍?‍?‍?|?‍?‍?‍?|?‍?‍?‍?|?‍?‍?‍?|?‍?‍?‍?|?‍?‍?‍?|?‍?‍?|?‍❤️‍?|?‍❤️‍?|?‍❤️‍?|?‍?‍?|?‍?‍?|?‍?‍?|?‍?‍?|?‍?‍?|?‍?‍?|?‍?‍?|?‍?‍?|?‍?‍?|?‍?‍?|?‍?‍?|?‍?‍?|?️‍?️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍⚕️|??‍⚕️|??‍⚕️|??‍⚕️|??‍⚕️|??‍⚕️|??‍⚕️|??‍⚕️|??‍⚕️|??‍⚕️|??‍⚕️|??‍⚕️|??‍⚕️|??‍⚕️|??‍⚕️|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍⚖️|??‍⚖️|??‍⚖️|??‍⚖️|??‍⚖️|??‍⚖️|??‍⚖️|??‍⚖️|??‍⚖️|??‍⚖️|??‍⚖️|??‍⚖️|??‍⚖️|??‍⚖️|??‍⚖️|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍✈️|??‍✈️|??‍✈️|??‍✈️|??‍✈️|??‍✈️|??‍✈️|??‍✈️|??‍✈️|??‍✈️|??‍✈️|??‍✈️|??‍✈️|??‍✈️|??‍✈️|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍?|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♂️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|??‍♀️|?‍?️|?️‍♂️|?️‍♀️|?️‍♂️|?️‍♀️|?️‍♂️|?️‍♀️|?️‍?|?️‍⚧️|⛹?‍♂️|⛹?‍♂️|⛹?‍♂️|⛹?‍♂️|⛹?‍♂️|⛹?‍♀️|⛹?‍♀️|⛹?‍♀️|⛹?‍♀️|⛹?‍♀️|?‍?|?‍?|❤️‍?|❤️‍?|?‍♂️|?‍♀️|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍♀️|?‍♂️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍⚕️|?‍⚕️|?‍⚕️|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍⚖️|?‍⚖️|?‍⚖️|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍✈️|?‍✈️|?‍✈️|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍?|?‍?|?‍?|?‍?|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍?|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|⛹️‍♂️|⛹️‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍♂️|?‍♀️|?‍?|?‍?|?‍?|?‍?|?‍?|?‍❄️|?‍☠️|?‍⬛|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|??|#️⃣|0️⃣|1️⃣|2️⃣|3️⃣|4️⃣|5️⃣|6️⃣|7️⃣|8️⃣|9️⃣|✋?|✋?|✋?|✋?|✋?|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?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|?|☺|☹|☠|❣|❤|✋|✌|☝|✊|✍|⛷|⛹|☘|☕|⛰|⛪|⛩|⛲|⛺|♨|⛽|⚓|⛵|⛴|✈|⌛|⏳|⌚|⏰|⏱|⏲|☀|⭐|☁|⛅|⛈|☂|☔|⛱|⚡|❄|☃|⛄|☄|✨|⚽|⚾|⛳|⛸|♠|♥|♦|♣|♟|⛑|☎|⌨|✉|✏|✒|✂|⛏|⚒|⚔|⚙|⚖|⛓|⚗|⚰|⚱|♿|⚠|⛔|☢|☣|⬆|↗|➡|↘|⬇|↙|⬅|↖|↕|↔|↩|↪|⤴|⤵|⚛|✡|☸|☯|✝|☦|☪|☮|♈|♉|♊|♋|♌|♍|♎|♏|♐|♑|♒|♓|⛎|▶|⏩|⏭|⏯|◀|⏪|⏮|⏫|⏬|⏸|⏹|⏺|⏏|♀|♂|⚧|✖|➕|➖|➗|♾|‼|⁉|❓|❔|❕|❗|〰|⚕|♻|⚜|⭕|✅|☑|✔|❌|❎|➰|➿|〽|✳|✴|❇|©|®|™|ℹ|Ⓜ|㊗|㊙|⚫|⚪|⬛|⬜|◼|◻|◾|◽|▪|▫)

Regex 101 Demo (compact, unsafe literal emoji version)

Regex 101 Demo (long, safe unicode escape version)

演示的输入字符串包括来自

的所有字符

https://unicode.org/emoji/charts/full-emoji-list.html (13.1)

https://unicode.org/emoji/charts-13.1/full-emoji-modifiers.html

工作示例(直接链接到 github 上的正则表达式):

/*compile the pattern string into a regex*/
let emoRegex = new RegExp(emojiPattern, "g")

/*extracting the emojis*/
let emojis = [..."This ??‍⚖️is the ?‍♀️text??‍❤️‍?‍??.".matchAll(emoRegex)];
console.log(emojis)

/*count of emojis*/
let emoCount = [..."This ??‍⚖️is the ?‍♀️text??‍❤️‍?‍??.".matchAll(emoRegex)].length
console.log(emoCount)

/*strip emojis from text*/
let stripped = "This ??‍⚖️is the ?‍♀️text??‍❤️‍?‍??.".replaceAll(emoRegex, "")
console.log(stripped)

/*use the pattern string to build a custom regex*/
let customRegex = new RegExp(".*"+emojiPattern+"3$") //match a string ending in 3 emojis
console.log(customRegex.test("yep three here ??‍⚖️??‍❤️‍?‍??")) //true
console.log(customRegex.test("nope ???‍❤️‍?‍??")) //false
<script src="https://gitcdn.link/repo/sweaver2112/Regex-combined-emojis/master/regex.js"></script>

【讨论】:

【参考方案8】:

您可以使用正则表达式在输入文本中检测它:

/([\uE000-\uF8FF]|\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDDFF])/g

【讨论】:

不匹配所有表情符号/^([\uE000-\uF8FF]|\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDDFF])+$/.test("?") // false【参考方案9】:

我编写了以下函数:containsEmojis(input, includeBasic=true),它根据 Unicode 规范版本 13 中定义的表情符号列表检查输入字符串中的表情符号(参见 https://unicode.org/Public/emoji/13.0/emoji-sequences.txt),并允许忽略可以忽略的“基本”表情符号仅用 3 个字节表示。

下面的sn-p定义了函数并运行了几个测试用例:

/**
* iterates over the code points of an input string and returns true if an emoji is found.
* 
* an emoji is found if the hex code for the character is 5 characters starting with "1F",
* or if @includeBasic is true, the character is 4 and starts with one of the prefixes of
* a basic emoji as defined in the Unicode specification version 13 
* see https://unicode.org/Public/emoji/13.0/emoji-sequences.txt
* 
* @input the string to check
* @includeBasic include also the basic emojis that only take 3 characters
*/
function containsEmojis(input, includeBasic) 

    if (typeof includeBasic == "undefined")
        includeBasic = true;

    for (var c of input) 
        var cHex = ("" + c).codePointAt(0).toString(16);
        var lHex = cHex.length;
        if (lHex > 3) 

            var prefix = cHex.substring(0, 2);

            if (lHex == 5 && prefix == "1f") 
                return true;
            

            if (includeBasic && lHex == 4) 
                if (["20", "21", "23", "24", "25", "26", "27", "2B", "29", "30", "32"].indexOf(prefix) > -1)
                    return true;
            
        
    

    return false;



// can be tested as follows:
var input;
input = "Hello World!";
console.log(input, containsEmojis(input));

input = "Hello ?!";
console.log(input, containsEmojis(input));

console.log(input, containsEmojis(input, false));

// now try a basic emoji
input = "It sparkles ✨ yay!";
console.log(input, containsEmojis(input));

// pass false for includeBasic
console.log(input, containsEmojis(input, false));

【讨论】:

【参考方案10】:

像下面这样检查表情符号

function getEmojiChars(text) 

console.log(text.match(/\ud83c[\udf00-\udfff]|\ud83d[\udc00-\ude4f]|\ud83d[\ude80-\udeff]/g))  ;

您将在文本中获得表情符号数组

【讨论】:

这不适用于大多数表情符号。

以上是关于如何使用 javascript 检测表情符号的主要内容,如果未能解决你的问题,请参考以下文章

如何使用 javascript 删除表情符号代码?

[使用message.content.startswith时如何使Discord机器人对服务器表情符号做出反应

您如何让机器人使用自定义表情符号添加反应?

如何将包含表情符号的字符串拆分为数组?

Regex:过滤特殊字符(如日语),但保留表情符号

如何在 Discord.js 中按名称查找表情符号