简体   繁体   English

用于捕捉表情符号的所有肤色变化的正则表达式

[英]Regular expression for capturing all skin-tone variations of an emoji

I'm trying to use a regex to capture tweets containing the substring 👏 at least twice, so I'm using an unsophisticated ^.+ 👏 .+ 👏 .+$ . 我正在尝试使用正则表达式来捕获包含子串👏推文至少两次,所以我使用的是一个不复杂的^.+ 👏 .+ 👏 .+$ However this doesn't match strings which instead contain, for example, 👏🏼 . 但是,这与字符串不匹配,而字符串包含例如👏🏼

Is there a smart way I can capture an emoji with any or none skin-tone variation, without just putting each one in a row (like [👏👏🏻👏🏼👏🏽👏🏾👏🏿] )? 有没有一种聪明的方法我可以捕捉任何或没有肤色变化的表情符号,而不是只将每一个连成一排(如[👏👏🏻👏🏼👏🏽👏🏾👏🏿] )?

Thanks to comments above, I've found that emojis I've encountered on twitter are unicode, and skin-tone variations are combining characters in the range 1f3fb1f3ff . 感谢上面的评论,我发现我在twitter上遇到的表情符号是unicode,肤色变化组合了1f3fb - 1f3ff范围内的字符。

http://unicode.org/reports/tr51/#Emoji_Modifiers_Table http://unicode.org/reports/tr51/#Emoji_Modifiers_Table

So for me what I wanted was 👏[\\x{1f3fb}-\\x{1f3ff}]? 所以对我来说我想要的是👏[\\x{1f3fb}-\\x{1f3ff}]? , with [\\x{1f3fb}-\\x{1f3ff}]? [\\x{1f3fb}-\\x{1f3ff}]? being something I can then drop next to any unmodified emoji to include skin-tone variations. 然后,我可以放在任何未经修改的表情符号旁边,以包括肤色变化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM