Skip to content

Instantly share code, notes, and snippets.

@fabiospampinato
Last active February 24, 2024 20:46
Show Gist options
  • Save fabiospampinato/d6d7ec6503f403532ab7b18e99cf9808 to your computer and use it in GitHub Desktop.
Save fabiospampinato/d6d7ec6503f403532ab7b18e99cf9808 to your computer and use it in GitHub Desktop.
A regex that can match any emoji, I think. It will also match some emojis that are nonsensically joined by a zero-width joiner though. And nonsensical applications of skin tone modifiers too.
const emojiRe = /(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F)(?:\u200d(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F))*/gu;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment