|
|
RegExp对象 正式表达式~
Function RegExpTest(patrn, strng) Dim regEx, Match, Matches ' 建立变量。 Set regEx = New RegExp ' 建立正则表达式。 regEx.Pattern = patrn ' 设置模式。 regEx.IgnoreCase = True ' 设置是否区分字符大小写。 regEx.Global = True ' 设置全局可用性。 Set Matches = regEx.Execute(strng) ' 执行搜索。 For Each Match in Matches ' 遍历匹配集合。 RetStr = retstr& Match.FirstIndex '位置 RetStr = RetStr & Match.Value '返回值 retstr=retstr+"
" retstr = regEX.Replace(strng,"$1")'代换 Next RegExpTest = RetStr End Function response.write (RegExpTest("\[b\](.[^\[]*)(\[\/b\])", "asefwet2463464366666666666666666")) 现在许多论坛的UBB都用这个,不知大家对这个对像有什么理解~
2003-9-8 0:44:00
阿克
![]()
|
|