I need a Regex to match all unicode emojis. I need this to check if a discord message has a Unicode Emoji in it.
// Here is a example of matching one Unicode Emoji
message.content.match(/๐/g)
// or two
message.content.match(/๐|๐/g)
// and three
message.content.match(/๐|๐|๐/g)
// then so on.
I have gotten up to like the last 300 or so emojis with this method then it stops working, sending all kinds of errors and stuff.
Is there a better way to do this? and if there is then can you give me an example in the comments. Im new to coding and don't really understand regex and some other stuff so having an example would help a lot. Also I code in JavaScript with node.js on Visual Studio Code.
UPDATE: there is a way that does work and i'm so grateful to Lioness100 for telling about it. There is a npm package called Emoji-Regex. Very useful!
var emojiRegex = /\p{Emoji}/gu
. โ Endocardialemoji-regex
โ Spada\p{Emoji}
to work but\p{Emoji_Presentation}
did. See this example. โ Bickart