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替换为红色的。
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替换为红色的。
推荐阅读