0

I am facing problem to remove keyboard emoticons from string. Keyboard emoticons display in URL So I use this regex to remove emoticons but this regex also remove Chinese character from string. I want regex remove only keyboard emoticons rather then any character. Keyboard emoticons icon belong utf8mb4 character set.

$str =~ s/[\x00-\x1F\x80-\xFF]+\s*//g;

$str =~ s/\xEE[\x80-\xBF][\x80-\xBF]|\xEF[\x81-\x83][\x80-\xBF]+\s*//g;

$str =~ s/([0-9#][\x{20E3}])|[\x{00ae}\x{00a9}\x{203C}\x{2047}\x{2048}\x{2049}\x{3030}\x{303D}\x{2139}\x{2122}\x{3297}\x{3299}][\x{FE00}-\x{FEFF}]?|[\x{2190}-\x{21FF}][\x{FE00}-\x{FEFF}]?|[\x{2300}-\x{23FF}][\x{FE00}-\x{FEFF}]?|[\x{2460}-\x{24FF}][\x{FE00}-\x{FEFF}]?|[\x{25A0}-\x{25FF}][\x{FE00}-\x{FEFF}]?|[\x{2600}-\x{27BF}][\x{FE00}-\x{FEFF}]?|[\x{2900}-\x{297F}][\x{FE00}-\x{FEFF}]?|[\x{2B00}-\x{2BF0}][\x{FE00}-\x{FEFF}]?|[\x{1F000}-\x{1F6FF}][\x{FE00}-\x{FEFF}]|[\x{D83E}][\x{DD13}-\x{DD14}]?+\s*//g;

$str =~ s/([0-9|#][\x{20E3}])|[\x{00ae}\x{00a9}\x{203C}\x{2047}\x{2048}\x{2049}\x{3030}\x{303D}\x{2139}\x{2122}\x{3297}\x{3299}][\x{FE00}-\x{FEFF}]?|[\x{2190}-\x{21FF}][\x{FE00}-\x{FEFF}]?|[\x{2300}-\x{23FF}][\x{FE00}-\x{FEFF}]?|[\x{2460}-\x{24FF}][\x{FE00}-\x{FEFF}]?|[\x{25A0}-\x{25FF}][\x{FE00}-\x{FEFF}]?|[\x{2600}-\x{27BF}][\x{FE00}-\x{FEFF}]?|[\x{2900}-\x{297F}][\x{FE00}-\x{FEFF}]?|[\x{2B00}-\x{2BF0}][\x{FE00}-\x{FEFF}]?|[\x{1F000}-\x{1F6FF}][\x{FE00}-\x{FEFF}]?+\s*//g;

Aditya Tomar
  • 175
  • 1
  • 3
  • 9
  • 1
    You might wanna take a look at this http://stackoverflow.com/questions/28077049/regex-matching-emoticons – Klemen Tusar Jan 12 '17 at 10:03
  • @techouse, that question is completely unrelated, as it's for "text" emoticons (e.g. `:-)`) rather than Unicode emoticons (e.g. ). – jcaron Jan 12 '17 at 10:16
  • I see, how about this http://crocodillon.com/blog/parsing-emoji-unicode-in-javascript – Klemen Tusar Jan 12 '17 at 10:23
  • I can't find an easy solution for this anywhere on the web.`/[^\u{1F600}-\u{1F6FF}\s]/` is the closest I've found but that doesn't compile. – Sridhar Sarnobat Feb 04 '21 at 19:45

0 Answers0