Home  >  Article  >  Backend Development  >  求一正则表达式,替换某一规则的表情符号为表情图标(<img>表情)解决思路

求一正则表达式,替换某一规则的表情符号为表情图标(<img>表情)解决思路

WBOY
WBOYOriginal
2016-06-13 10:19:221186browse

求一正则表达式,替换某一规则的表情符号为表情图标(求一正则表达式,替换某一规则的表情符号为表情图标(<img>表情)解决思路表情)
求一正则表达式,替换某一规则的表情符号为表情图标(求一正则表达式,替换某一规则的表情符号为表情图标(<img>表情)解决思路表情)

[高兴] 替换为 求一正则表达式,替换某一规则的表情符号为表情图标(<img>表情)解决思路 (用中文命名图片规不规范?)

其实最好还是用JS来比较好的。

------解决方案--------------------
$str='[高兴]表情图片';
echo preg_replace('/\[(.*)\]/',"求一正则表达式,替换某一规则的表情符号为表情图标(<img>表情)解决思路",$str);

------解决方案--------------------
这年头,什么都正则...
用中文名做文件名的确不是明智的做法.

function replaceStr($str){
$str=substr($str,strpos($str,'[')+1,strlen($str)-2);
return "求一正则表达式,替换某一规则的表情符号为表情图标(<img>表情)解决思路";
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn