1F600
-1F64F. So there should be a way to filter them with javascript...
var emoji = "😟
Hello 😟";
emoji = emoji.replace(/[^\x00-\xFFFF]/g, "");
alert(emoji);
var hs = 0xD800; // high surrogate bitmask 1101100000000000
var ls = 0xDC00; // low surrogate bitmask 1101110000000000
var high;
var low;
var code;
for(i = 0; i < text.length; i++)
{
high = text.charCodeAt(i);
// char-code is high surrogate and there is another char-codes?
// unicode characters higher than uFFFF are represented by two char-codes in JS
if(((high >> 10) == 54) && ((i+1) < text.length))
{
// get next char-code
low = text.charCodeAt(i+1);
// char-code is low surrogate?
if(( low >> 10) == 55)
// calculate code point
{
// subtract high surrogate identifier and shift ten bits to the left
high = (high - hs) << 10;
// subtract low surrogate identifier
low = low - ls;
code = high + low + 0x10000;
// is Emoji?
if((code >= 0x1F600) && (code <= 0x1F64F))
alert("Emoji at " + i + ": " + code.toString(16).toUpperCase());
}
}
}
I'm not sure if my approach with the regex is correct (it deletes everything that is not in the BMP (?)).
So the problem is the string I entered did NOT have an emoji.
It spits an uncought error ILLEGAL at line 37.
text = text.replace(/\uD83D[\uDE00-\uDE4F]/g, "");
To clarify: that works with Javascript...
Yeah, but how to make it work in Tasker?