首页 > Web开发 > 详细

vbs:把一段文字中指定字符颜色变成红色的正则

时间:2015-12-31 06:57:28      阅读:927      评论:0      收藏:0      [点我收藏+]
vbs:把一段文字中指定字符颜色变成红色的正则

 
function c(Tstr,Word) 
Dim re 
Set re = new RegExp 
re.IgnoreCase =True 
re.Global=True 
re.pattern = "("&Word&")" 
c=re.replace(Tstr,"<font style=‘color:red;‘>$1</font>") 
End function 

调用方法 

response.write c("内容字串","要显示为红色的字") 

比如 

<% 
function c(Tstr,Word) 
Dim re 
Set re = new RegExp 
re.IgnoreCase =True 
re.Global=True 
re.pattern = "("&Word&")" 
c=re.replace(Tstr,"<font style=‘color:red;‘>$1</font>") 
End function 
Response.write("lamking.com","a") 
%> 
就把lamking.com中的a替换为红色的。 

vbs:把一段文字中指定字符颜色变成红色的正则

原文:http://www.jb51.net/article/9223.htm

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!