mathiasbynens / emoji-regex

A regular expression to match all Emoji-only symbols as per the Unicode Standard.
https://mths.be/emoji-regex
MIT License
1.72k stars 175 forks source link

Bug: The regex in text.js and index.js are the same? #69

Closed junjizhi closed 4 years ago

junjizhi commented 4 years ago

https://github.com/mathiasbynens/emoji-regex/blob/master/src/index.js:

/<% emojiSequence %>|\p{Emoji_Presentation}|\p{Emoji}\uFE0F|\p{Emoji_Modifier_Base}/gu;

https://github.com/mathiasbynens/emoji-regex/blob/master/src/text.js:

/<% emojiSequence %>|\p{Emoji_Presentation}|\p{Emoji}\uFE0F?|\p{Emoji_Modifier_Base}/gu;

Notice it is missing a ? in the first regex besides \uFE0F

mathiasbynens commented 4 years ago

This is the difference between index.js and text.js. From the README:

To match emoji in their textual representation as well (i.e. emoji that are not Emoji_Presentation symbols and that aren’t forced to render as emoji by a variation selector), require the text regex: [...]