好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

VBS中利用正则把一段文字中指定字符颜色变成红色的实现方法

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中利用正则把一段文字中指定字符颜色变成红色的实现方法的详细内容...

  阅读:54次