Skip to content

None of the regexes match emoji, and only emoji #174

Description

@robintown

A regex that matches emoji would be a really useful thing to have in the JS ecosystem! Unfortunately, between Emojibase and emoji-regex, I still haven't seen a package that actually does this. In the case of Emojibase:

  • emojibase-regex matches some textual characters such as '↔'.
  • emojibase-regex/emoji doesn't match emoji without U+FE0F, such as '✨'.
  • emojibase-regex/emoji-loose matches some textual characters without U+FE0E, such as '↔'.
  • And the rest of the provided regexes are obviously not intended to be used for matching emoji.

What's missing is a regex that matches exactly those character sequences that are presented to users as emoji. Some characters are defined in Unicode to default to emoji presentation (see the Emoji_Presentation section), while others require U+FE0F to change their presentation mode. A correct implementation would account for both of these facts, and use a negative lookahead to avoid matching characters with U+FE0E.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions