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

Does not match all combinations of emojis that support multiple skin tones #65

Closed scriby closed 3 years ago

scriby commented 4 years ago

For instance, the regex will match πŸ§‘πŸΌβ€πŸ€β€πŸ§‘πŸ» ('\u{1F9D1}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F9D1}\u{1F3FB}'), but it doesn't match πŸ§‘πŸ»β€πŸ€β€πŸ§‘πŸΌ ('\u{1F9D1}\u{1F3FB}\u200D\u{1F91D}\u200D\u{1F9D1}\u{1F3FC}'). It seems to only work if the darker skin tone is on the left side. There are some more emojis that support multiple skin tones coming, so it would be great if this could match against all possible combinations.

scriby commented 4 years ago

It looks like this issue is resolved in Unicode 12.1 where both combinations are in the RGI.

JuanCarlosC commented 4 years ago

@scriby I am still experiencing the same issue where it will only work if the darker skin tone is on the left side. Did you find a solution?

I've used the inject-sequences.js script to update the regular expression based on the data from Unicode v12.1, but still seeing the same issue.

Screen Shot 2020-02-25 at 8 03 45 PM
scriby commented 4 years ago

Supporting the darker skin tones on the left was included in Unicode 12.1. So if you’re running against v12 they won’t work.

On Tue, Feb 25, 2020 at 8:06 PM JuanCarlos Chavez notifications@github.com wrote:

@scriby https://github.com/scriby I am still experiencing the same issue where it will only work if the darker skin tone is on the left side. Did you find a solution?

I've used the inject-sequences.js script to update the regular expression based on the data from Unicode v12, but still seeing the same issue.

[image: Screen Shot 2020-02-25 at 8 03 45 PM] https://user-images.githubusercontent.com/7284135/75310901-00873680-580a-11ea-995a-581ad1024134.png

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mathiasbynens/emoji-regex/issues/65?email_source=notifications&email_token=AAGHAVBEPSORDLQ3QWSMZBTREXTCXA5CNFSM4KBP3QTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEM6WY4I#issuecomment-591228017, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGHAVG3T3OXWJGSYJPESU3REXTCXANCNFSM4KBP3QTA .

JuanCarlosC commented 4 years ago

@scriby updated my comment above. Yes, I ran this script against 12.1. Are you no longer experiencing the issue?

scriby commented 4 years ago

I ended up stopping using this library since it wasn’t clear when it would be updated, so I don’t know if it works properly or not when ran against 12.1. But it seems like it should work... Maybe double-check your node_modules to make sure it’s running against the right version of Unicode?

On Tue, Feb 25, 2020 at 8:52 PM JuanCarlos Chavez notifications@github.com wrote:

@scriby https://github.com/scriby updated my comment above. Yes, I ran this script against 12.1. Are you no longer experiencing the issue?

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mathiasbynens/emoji-regex/issues/65?email_source=notifications&email_token=AAGHAVHJN7KVIICMXQ3ZFLDREXYPXA5CNFSM4KBP3QTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEM6ZEIY#issuecomment-591237667, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGHAVEIGBZHGIJGP2UEQY3REXYPXANCNFSM4KBP3QTA .

mathiasbynens commented 3 years ago

If I understand the issue correctly, it looks like this has already been fixed when I updated to the latest Unicode version:

$ node -p "require('emoji-regex')().exec('\u{1F9D1}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F9D1}\u{1F3FB}')"
[ 'πŸ§‘πŸΌβ€πŸ€β€πŸ§‘πŸ»', index: 0, input: 'πŸ§‘πŸΌβ€πŸ€β€πŸ§‘πŸ»', groups: undefined ]

$ node -p "require('emoji-regex')().exec('\u{1F9D1}\u{1F3FB}\u200D\u{1F91D}\u200D\u{1F9D1}\u{1F3FC}')"
[ 'πŸ§‘πŸ»β€πŸ€β€πŸ§‘πŸΌ', index: 0, input: 'πŸ§‘πŸ»β€πŸ€β€πŸ§‘πŸΌ', groups: undefined ]

@scriby Can you confirm this is now behaving as you expected?

mathiasbynens commented 3 years ago

Closing since I believe this has been resolved. Feel free to reopen if I misunderstood.