Convert successive emoji, special characters, and Spaces to a single –

/([\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9| #]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030|[“#%& (a) + / : :;; < = >?? @ \ \ | “” ()” “]) + / g

+ : Matches one or more matches

| : or

const emojiRegStr = ‘[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|# ]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\\uA9|\\uAE|\u3030’;

Const specCharRegStr = ‘[” # % & () +,, / : :;; < = >?? @ \ | “” ()” >’;

Const targetReg = eval (` / (emojiRegStr ∣ {emojiRegStr} | emojiRegStr ∣ {specCharRegStr}) + / g `);

Const STR = “😉😆😂😄 😆 $%^^&& hahaha”

str.replace(targetReg, ‘-‘);

Define basic regular expression strings, which are evaluated using eval and executed as regular expressions.

This allows you to define multiple regees for easy use in combination