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.72k stars 175 forks source link

some variations of emojis are not working with current version of emoji-regex library #108

Open forebitt opened 1 year ago

forebitt commented 1 year ago

I'm trying to build an input which only accepts alphanumeric and emoji characters. This is my implementation:

import emojiRegex from "emoji-regex";

const isValidInput = (input: string) => {
        const emojisPattern = emojiRegex();
        const alphanumPattern = /^[a-zA-Z0-9\s]+(\.app)?$/;
        const withoutEmojis = input.replace(emojisPattern, "e");
        return alphanumPattern.test(withoutEmojis);
      };

this is the emoji "🧑🏼‍❤️‍🧑🏼" I'm trying to parse, the library is supporting all other variation of this emoji, except this variation. Is there a way to fix it? https://emojipedia.org/couple-with-heart-person-person-light-skin-tone-medium-skin-tone/