用户登录
用户注册

分享至

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

  • 作者: 毕竟是凡人
  • 来源: 51数据库
  • 2021-09-04
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替换为红色的。 
软件
前端设计
程序设计
Java相关