vbs:把一段文字中指定字符顏色變成紅色的正則
更新時(shí)間:2007年04月06日 00:00:00 作者:
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
調(diào)用方法
response.write c("內(nèi)容字串","要顯示為紅色的字")
比如
<%
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
調(diào)用方法
response.write c("內(nèi)容字串","要顯示為紅色的字")
比如
<%
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替換為紅色的。
相關(guān)文章
JavaScript正則表達(dá)式迷你書之貪婪模式-學(xué)習(xí)筆記
這篇文章主要介紹了JavaScript正則表達(dá)式迷你書之貪婪模式-學(xué)習(xí)筆記,需要的朋友可以參考下2020-02-02淺談js正則字面量//與new RegExp的執(zhí)行效率
以前看到很多文章都說 字面量 會(huì)比 new 對(duì)象 形式效率高,但是在正則這里,好像不是這么回事,具體的請(qǐng)看下面的分析2020-04-04比較正宗的驗(yàn)證郵箱的正則表達(dá)式j(luò)s代碼詳解
郵箱正則最正宗的一條正則語句是^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$ 下面我們來講解一下2012-09-09