Match Emojis with Regular Expressions
When experimenting with unicode property escapes, to identify accented letters in strings, it reminded me of a question I had a few years ago:  what is the best way to identify and then replace emojis in a string?  I first noticed this practice when using emojis in Facebook -- sometimes Facebook would replace an emoji with one of their own custom images, likely because another device may not support that emoji.
Much the way you can match accented characters, you can use unicode property escapes to match emojis:
const emojis = "😂😂💯".match(/\p{Emoji_Presentation}/gu);
// ["😂", "😂", "💯"]
I've previously seen massive arrays of every emoji ever created, and it may be possible that {Emoji_Presentation} doesn't contain all emojis across all devices, but this regex has matched every case I've come across.
Happy emoji....ing!
![Write Better JavaScript with Promises]()
You've probably heard the talk around the water cooler about how promises are the future. All of the cool kids are using them, but you don't see what makes them so special. Can't you just use a callback? What's the big deal? In this article, we'll...
![Interview with a Pornhub Web Developer]()
Regardless of your stance on pornography, it would be impossible to deny the massive impact the adult website industry has had on pushing the web forward. From pushing the browser's video limits to pushing ads through WebSocket so ad blockers don't detect them, you have...
![Comment Preview Using MooTools]()
Comment previewing is an awesome addition to any blog.  I've seen really simple comment previewing and some really complex comment previewing.  The following is a tutorial on creating very basic comment previewing using MooTools.
The XHTML
You can set up your XHTML any way you'd like.
![CSS @supports]()
Feature detection via JavaScript is a client side best practice and for all the right reasons, but unfortunately that same functionality hasn't been available within CSS.  What we end up doing is repeating the same properties multiple times with each browser prefix.  Yuck.  Another thing we...
Great stuff!
But actually there are quite a few where
Emoji_Presentationdoes not work. Probably most of (all?) marked here as not Emoji_Presentation https://www.unicode.org/Public/UCD/latest/ucd/emoji/emoji-data.txt but Extended_Pictographic or just Emoji..match(/\p{Emoji}/gu);work too well (matching 1-9, # and *) but
.match(/(\p{Emoji_Presentation}|\p{Extended_Pictographic})/gu)seems to do the charm :)