Skip to content

Instantly share code, notes, and snippets.

@satans17
Last active January 19, 2023 06:53
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save satans17/38b54d7803598b1aa83d to your computer and use it in GitHub Desktop.
Save satans17/38b54d7803598b1aa83d to your computer and use it in GitHub Desktop.
replace emoji for javascript
//https://github.com/node-modules/emoji
//http://apps.timwhitlock.info/emoji/tables/unicode
var unified_emoji_ranges = [
'\ud83c[\udf00-\udfff]', // U+1F300 to U+1F3FF
'\ud83d[\udc00-\ude4f]', // U+1F400 to U+1F64F
'\ud83d[\ude80-\udeff]' // U+1F680 to U+1F6FF
];
var reg = new RegExp(unified_emoji_ranges.join('|'), 'g');
console.log("🐬 πŸ™ 🐟 🐠 🐑 🐚 🐌 πŸ› 🐜 🐝 🐞 🐾".replace(reg, "[葨情]"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment