Skip to content

Instantly share code, notes, and snippets.

@csandman
Created September 24, 2019 02:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csandman/38caf1031d36e1c04dae3c9ad0009313 to your computer and use it in GitHub Desktop.
Save csandman/38caf1031d36e1c04dae3c9ad0009313 to your computer and use it in GitHub Desktop.
A JS function to pull all emojis from a string into a new array (From lodash)
function parseEmojis(str) {
return str.match(/(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0]|\ud83c[\udffb-\udfff])?)*/);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment