日期:2014-05-16 浏览次数:21264 次
<script runat="server" language="jscript">
function getFileName(v) {var arr = v.split('/');return arr[arr.length - 1].split('.')[0]; }
function replaceImg(reStr, v) {
var re = new RegExp(reStr, 'gi');
return v.replace(re, function ($0, $1) {
return '<img src="' + $1 + '" alt="' + getFileName($1) + '">';
});
}
</script>
<%
strContent="[img=upload/2345.jpg]abcd[/img]"
strContent=replaceImg("\[img=(.[^\]]*)\](.*?)\[\/img]",strContent)
response.Write strContent
%>