79511233

Date: 2025-03-15 13:57:33
Score: 1
Natty:
Report link

I saw the {Emoji} and other Unicode character class escapes in some answers to achieve the goal, but no one explains how they work, which have been part of the baseline since July 2015:

After reviewing the mentioned tables, the most promising one seems to be Extended_Pictographic:

function removeEmojis(str) {
  return str.replace(/[\p{Extended_Pictographic}]/gu, '');
}

let text = "Hello 🌍! This is a test with ❤️ and 123. 😃";
let cleanedText = removeEmojis(text);

console.log(cleanedText); // "Hello ! This is a test with  and 123."

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • High reputation (-1):
Posted by: rozsazoltan