<%@LANGUAGE="VBSCRIPT" CODEPAGE="950"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<title>無標題文檔</title>
<script>
function getKeyword(str)
{
strKey=str.replace(//<a target/=/"/_blank/" href/=/"http/:webhosthk/.com/?keyword/=/gi,"");
strKey=strKey.replace(//"/>/gi,"");
document.write(str+strKey);
//alert(strKey);
}
</script>
</head>
<body>
<%
str1="aaaa[%你好%]bb[%測試%]cc[%關鍵字%]ppppppp"
str2=replace(str1,"[%","<script>getKeyword('<a target=""_blank"" href=""http://webhosthk.com?keyword=")
str3=replace(str2,"%]",""">')</script></a>")
%>
原字串:<%=str1%><br>
<br>
輸出HTML:<%=str3%>
<br>
利用javascrip正則運算式+asp 可實現這種功能Ben
</body>
</html>