googlefonts / noto-emoji

Noto Emoji fonts
SIL Open Font License 1.1
3.74k stars 451 forks source link

Regex similar to Twemoji's #380

Closed nunoperalta closed 2 years ago

nunoperalta commented 2 years ago

Is there a maintained "regex" that is compatible with your codepoints? (or a way to generate one)

Something similar to this Twemoji's regex: https://github.com/twitter/twemoji-parser/blob/master/src/lib/regex.js

I've been using Twemoji's regex to convert plaintext into Noto Emoji PNG, but there isn't support to 14.0 yet. (and might not contain exactly the same amount of emoji as Noto Emoji)

return String(str).replace(twemojiRegex, function (emoji) {
    var codepoint = emojiToCodePoint(emoji);
    ...
    return '<img ...>';
});

One good thing about it also, is that it's well "compressed" (reduces file size).

tomasdev commented 2 years ago

Not sure if any of these two work for you?

https://github.com/mathiasbynens/emoji-regex And https://github.com/googlefonts/emoji-metadata

On Sun, Feb 6, 2022, 11:28 AM nunoperalta @.***> wrote:

Is there a maintained "regex" that is compatible with your codepoints? (or a way to generate one)

Something similar to this Twemoji's regex: https://github.com/twitter/twemoji-parser/blob/master/src/lib/regex.js

I've been using Twemoji's regex to convert plaintext into Noto Emoji PNG, but there isn't support to 14.0 yet. (and might not contain exactly the same amount of emoji as Noto Emoji)

One good thing about it also, is that it's well "compressed" (reduces file size).

return String(str).replace(twemojiRegex, function (emoji) { var codepoint = emojiToCodePoint(emoji); ... return '<img ...>'; });

— Reply to this email directly, view it on GitHub https://github.com/googlefonts/noto-emoji/issues/380, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACY4ANDRFHD772QN2WSLOLUZ2OUTANCNFSM5NVQZJJQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

nunoperalta commented 2 years ago

Thanks! The first one might help yeah - seems to be exactly what I'm looking for!! Really appreciate that. Cheers.

This is the Regex-only repo: https://github.com/mathiasbynens/emoji-test-regex-pattern