您现在的位置是:网站首页> 编程资料编程资料
vbs:把一段文字中指定字符颜色变成红色的正则_正则表达式_
2023-05-25
456人已围观
简介 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,"$1")
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,"$1")
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,"$1")
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,"$1")
End function
Response.write("lamking.com","a")
%>
就把lamking.com中的a替换为红色的。
