Skip to content

Instantly share code, notes, and snippets.

@d-simon
Created March 8, 2014 01:43
Show Gist options
  • Save d-simon/9423875 to your computer and use it in GitHub Desktop.
Save d-simon/9423875 to your computer and use it in GitHub Desktop.
Emoji Regex
// http://crocodillon.com/blog/parsing-emoji-unicode-in-javascript
var 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 regexp = new RegExp(ranges.join('|'), 'g');
stringWithEmojis.replace(regexp, ''); // Strips all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment