使用正则来处理的一个例子,如果内容在文档中,自己可稍做修改,另:这里不替换“<>”,也就是当尖括号中内容为空时,不进行替换...
测试代码:
| dim test(4),regEx | | test(0)="22233< /b>3333aa" | | test(1)="<u8fj>d93j" | | test(2)="3" | | test(3)="OK<this is a test>test this" | | test(4)="test here<>test here" | | for i=0 to 4 | | Mystr=Mystr & vbcrlf & test(i) | | next | | msgbox "处理前字符:"&Mystr | | Set regEx = New RegExp | | regEx.Pattern ="<[^<]{1,}>" | | regEx.IgnoreCase = True | | regEx.Global = True | | msgbox regEx.replace(Mystr,"") COPY |
|