Hey so I need to create a script using googlespreadsheets (javascript) that takes the input of one cell and outputs all the emojis from that cell into the selected one. I want to do this by removing everything from the cell text except the emoji. This is because if I try to just match emojis my output is not correct.
I'm using this regex to locate emojis.
var re = /[\u1F60-\u1F64]|[\u2702-\u27B0]|[\u1F68-\u1F6C]|[\u1F30-\u1F70]|[\u2600-\u26ff]|[\uD83C-\uDBFF\uDC00-\uDFFF]+/gi;
How can I remove everything from the text except items with this regex. Or how can I remove everything but unicode. I have tried all the other suggestions but the output isn't correct or it doesn't work with spreadsheets.
Currently I have:
function SHOW_EMOJIS(s) {
var re = /[\u1F60-\u1F64]|[\u2702-\u27B0]|[\u1F68-\u1F6C]|[\u1F30-\u1F70]|[\u2600-\u26ff]|[\uD83C-\uDBFF\uDC00-\uDFFF]+/gi;
var result = s.match(re).toString();
return result;
}
This returns all the emojis, but instead of seeing: โ ๏ธ๐โ๏ธ๐ฉ๐ปโโ๏ธโ๏ธ๐ฅ I see โ ,๐,โ,๐ฉ๐ป,โ,โ,๐ฅ . The doctor is returned as two separate emoji-characters.