正则替换成了字符

来源:百度知道 编辑:UC知道 时间:2024/06/16 12:39:14
TR <B>449616391 </B> <SPAN class=m>" </SPAN> <SPAN class=t> label </SPAN> <SPAN class=m>=" </SPAN> <B>通缉犯↘婆娘[449616391] </B> <SPAN class=m>" </SPAN> <SPAN class=m> /> </SPAN> </DIV> </DIV>
</SPAN> <B>625281357 </B> <SPAN class=m>" </SPAN> <SPAN class=t> label </SPAN> <SPAN class=m>=" </SPAN> <B>小樱子[625281357] </B> <SPAN class=m>" </SPAN> <SPAN class=m> /> </SPAN> </DIV> </DIV>
</SPAN> <B>627427573 </B> <SPAN class=m>" </SPAN> <SPAN class=t> label </SPAN> <SPAN class=m>=" </SPAN> <B>葬爱·叛逆[627427573] </B> <SPAN class=m>" </SPAN> <SPAN class=m> /> </SPAN> </DIV> </DIV>
</SPAN> <B>913498645 </B> <SPAN c

'试试这个
'注意读入字符串的时候把"去掉
Function Do_Find(Expression, FindStr)
Dim i, v_exp, v_str, all
Set v_exp = New RegExp
v_exp.Pattern = Expression
v_exp.Global = True
Set all = v_exp.Execute(FindStr)
i = 0
For Each v_str in all
i = i + 1
OutStr = OutStr & v_str
If i Mod 2 = 0 Then
OutStr = OutStr & vbCRLF
Else
OutStr = OutStr & " "
End If
Next
Do_Find = replace(replace(OutStr,"<B>",""),"</B>","")
End Function
MsgBox(Do_Find("<B>[^B]*<\/B>", "<B>449616391</B> <SPAN class=m></SPAN><SPAN class=t> label</SPAN> <SPAN class=m>=</SPAN><B>通缉犯↘婆娘[449616391]</B><SPAN class=m></SPAN> <SPAN class=m> /></SPAN> </DIV></DIV> </SP