挖新闻 > 软件 > 替换字符串中关键字的ASP函数

替换字符串中关键字的ASP函数

来源:新浪科技 作者:苹果 时间:2008-06-14 17:07:48

【IT168技术文档】

写时是针对英文的,也没测试输入中文是啥情况.不过中文的情况应该比处理起英文来要简单一点才对.
说明如下:
1. 被<>包含的关键字不会被替换
2. 在内部的关键字不会被替换.
此外,还可能有些BUG.
 1' link key word
2    function LinkKeyword(bIgnoreCase, MainStr, sNeedReplace, sReplaceWith)
3        dim sResult
4
5        Dim objRegExp
6        Set objRegExp = New Regexp
7        objRegExp.IgnoreCase = bIgnoreCase
8        objRegExp.Global = True
9        objRegExp.Pattern = "b" & sNeedReplace & "b(?![w ]*|>)"
10        sResult = objRegExp.Replace(MainStr, sReplaceWith)
11        Set objRegExp = Nothing
12
13        LinkKeyword = sResult
14    end function
标签: 函数 ASP 关键字 字符串 替换
[收藏] [推荐] [评论] [打印] [关闭] 点击:
评论:替换字符串中关键字的ASP函数
发表评论:【替换字符串中关键字的ASP函数】,不超过250字,请自觉遵守互联网相关政策法规。

匿名评论? 验证码: