function filteremoji(emojireg){ var ranges = [ '\ud83c[\udf00-\udfff]', '\ud83d[\udc00-\ude4f]', '\ud83d[\ude80-\udeff]' ]; emojiregRe = emojireg .replace(new RegExp(ranges.join('|'), 'g'), ''); return emojiregRe; }