当前位置:主页 > 查看内容

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

发布时间:2021-07-23 00:00| 位朋友查看

简介:vbs:把一段文字中指定字符颜色变成红色的正则 functionc(Tstr,Word) Dimre Setre=newRegExp re.IgnoreCase=True re.Global=True re.pattern=(Word) c=re.replace(Tstr,fontstyle='color:red;'$1/font) Endfunction 调用方法 response.writec(内容字串,要显示……
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替换为红色的。 

原文链接:https://m.jb51.net/article/9223.htm
本站部分内容转载于网络,版权归原作者所有,转载之目的在于传播更多优秀技术内容,如有侵权请联系QQ/微信:153890879删除,谢谢!
上一篇:js:校验IPv6地址的正则表达式 下一篇:没有了

推荐图文


随机推荐