zoukankan      html  css  js  c++  java
  • 移除微信昵称中的emoji字符

    移除微信昵称中的emoji字符:
    /**
     * 移除微信昵称中的emoji字符
     * @param type $nickname
     * @return type
     */
    function removeEmoji($nickname) {
        $clean_text = "";
        // Match Emoticons
        $regexEmoticons = '/[x{1F600}-x{1F64F}]/u';
        $clean_text = preg_replace($regexEmoticons, '', $nickname);
        // Match Miscellaneous Symbols and Pictographs
        $regexSymbols = '/[x{1F300}-x{1F5FF}]/u';
        $clean_text = preg_replace($regexSymbols, '', $clean_text);
        // Match Transport And Map Symbols
        $regexTransport = '/[x{1F680}-x{1F6FF}]/u';
        $clean_text = preg_replace($regexTransport, '', $clean_text);
        // Match Miscellaneous Symbols
        $regexMisc = '/[x{2600}-x{26FF}]/u';
        $clean_text = preg_replace($regexMisc, '', $clean_text);
        // Match Dingbats
        $regexDingbats = '/[x{2700}-x{27BF}]/u';
        $clean_text = preg_replace($regexDingbats, '', $clean_text);
        //截取指定长度的昵称
        $clean_text = ds_substing($clean_text,0,20);
        return trim($clean_text);
    }
  • 相关阅读:
    Python-Re正则表达式库
    杂记
    Python 信息提取-beautifulsoup实例
    Python 中国大学排名定向爬虫
    matlab-汉字unicode编码转换
    Python-beautifulsoup库
    python 安装resquest
    python--数字灯管
    Python time库
    Python random库
  • 原文地址:https://www.cnblogs.com/jackzhuo/p/11883685.html
Copyright © 2011-2022 走看看