Advertisement
NubeColectiva

Extraer Emojis de un Texto o String con JavaScript

Nov 22nd, 2024
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const string = 'Mis frutas favoritas son: 🐻, 🙂, 🍎, 🍌 y 🍍. Me parecen deliciosas.';
  2. const resultado = string.match(/\ud83c[\udf00-\udfff]|\ud83d[\udc00-\ude4f]|\ud83d[\ude80-\udeff]/g).join('');
  3. console.log(resultado);
  4.  
  5. // Output: 🐻🙂🍎🍌🍍
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement