-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
feat(isEmoji): checks if string contains an emoji #2015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
isEmoji checks if the string contains an emoji
Codecov Report
@@ Coverage Diff @@
## master #2015 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 104 105 +1
Lines 2203 2210 +7
Branches 477 478 +1
=========================================
+ Hits 2203 2210 +7
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
|
This is an improvement to #1968 right? |
removed .idea folder
Yes, rather than listing all the possible emojis, the regex takes ranges of emojis. However, the regex definitely can be improved further. |
ParthJadhav
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM... Regex could be simplified. But it works great !
|
one question that comes to my mind here: I can see the latter being useful, but I can't really see any practical application for the former. |
Had a look at the other isEmoji functions. One of my initial solutions I found was to use
\p{Emoji}, however, it also accepts numbers and other symbols. There were other ones such as\p{Extended_Pictographic}but it didn't seem to work. I found that\p{Emoji_Presentation }worked but some emojis would not return true as they were considered symbols rather than an emoji, for example: ☂, ❤ , ©️, etc. Unfortunately the emoji unicode system is all over the place so I haven't been able to simplify the Regex to only accept the symbols that Emoji_Presentation cannot. Currently, the regex accepts emojis and emojis that are both symbols and emojis.Checklist