Created
March 8, 2014 01:43
-
-
Save d-simon/9423875 to your computer and use it in GitHub Desktop.
Emoji Regex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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