在网上找到一个解决办法,就是在Lotusscript代理中调用正则将得到的内容先替换,然后再截取内容片断。
具体代码如下(用于window平台):
Class RegExp
' RegExp -- use VBScript RegExp object to provide regular expressions ' 2004-06-03 David Phillips, rfdinc.com First version. Public matches As Variant Public oRegExp As Variant ' VBScript RegExp properties Public Pattern As String Public IgnoreCase As Boolean ' default = False Public Global As Boolean ' default = False Sub new () Set oRegExp = CreateObject ("VBScript.RegExp") End Sub Public Function Match (source As String, pattern As String) As Boolean ' RegEx.Match -- scan source for pattern, set matches collection and return true if any ' (Can't call it Execute as that collides with LotusScript built-in function and statement.) With oRegExp .Pattern = pattern ' regular expression to match .IgnoreCase = IgnoreCase .Global = Global Set matches = .Execute (source) ' do match Match = (Not 0 = matches.count) End With End Function Public Function Replaces (source As String, pattern As String, replacement As String) As String ' RegEx.Replaces -- scan source for pattern, if found substitute replacement, return result ' (Can't call it Replace as that collides with LotusScript built-in function.) With oRegExp .Pattern = pattern .IgnoreCase = IgnoreCase .Global = Global Replaces = .Replace (source, replacement) ' do replace End With End Function Public Function Test (source As String, pattern As String) As Boolean ' RegEx.Test -- scan source for pattern, return true if found With oRegExp .Pattern = pattern .IgnoreCase = IgnoreCase Test = .Test (source) End With End FunctionEnd Class
-----------------------然后这样进行调用---------------------------------------------------
Dim re As New RegExp
re.IgnoreCase = True ' 设置是否区分字符大小写。re.Global = True ' 设置全局可用性。Gst = re.Replaces (Gst, "<[^>]+>", "") '删除所有html标签