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.73k stars 174 forks source link

this will match 0 as if were a 0️⃣ :P #57

Closed titoBouzout closed 3 years ago

titoBouzout commented 5 years ago

This regexp is not useful when you want to match just emojis... because then you have a 0 and this library will think "oh yeah 0 could be an emoji as 0️⃣" but thats not what I was expecting.

if regexp '0' return false

if regexp '0️⃣' return true

mathiasbynens commented 3 years ago

That's because you're explicitly using the /text.js version of the regular expression. /text.js is supposed to match emoji in their text representation, as defined by the Unicode Standard, so this is working as intended. It sounds like you don't want to use /text.js — consider using one of the other regular expression flavors instead.