vb,如果想把网页源文件里面的所有被<>括起来的字符全部过滤掉删除掉,要怎么做到?
(包括<>本身和所有段落标记(回车符)也全部删掉)比如:
-----------------------------------
<p>The winner of the country's third largest lottery jackpot, 258 million yuan ($38.5 million), had yet to come forward by late Wednesday.</p>
<!--end 848400-159283-1-->
</div>
<p>A rocket attack in the Yemeni capital Sanaa on Wednesday targeted a vehicle carrying the deputy chief of the British mission in Yemen and a gunman opened
fire at an Austrian oil and gas firm, killing a Frenchman.</p>
<!--end 848401-159283-1-->
</div>
----------------------------------多谢!!
(包括<>本身和所有段落标记(回车符)也全部删掉)比如:
-----------------------------------
<p>The winner of the country's third largest lottery jackpot, 258 million yuan ($38.5 million), had yet to come forward by late Wednesday.</p>
<!--end 848400-159283-1-->
</div>
<p>A rocket attack in the Yemeni capital Sanaa on Wednesday targeted a vehicle carrying the deputy chief of the British mission in Yemen and a gunman opened
fire at an Austrian oil and gas firm, killing a Frenchman.</p>
<!--end 848401-159283-1-->
</div>
----------------------------------多谢!!
strArray = Split(InputStr, "<") 'InputStr输入的字符串
'得到数组,使用InStr在数组中查找>
For i = LBound(strArray) To UBound(strArray)
InStr(strArray(i),">") '得到>的所在位置StarStr
'使用Right 截取字符串
right(strArray(i),len(strArray(i))-StarStr)
next i
'把每个数组中截取的字符串组合起来,就差不多了。
'没有VB环境,没法帮你试,不过就是这个思路了。
http://topic.csdn.net/u/20070125/09/4de90530-eecd-4415-a9e1-4c85bc3b86f9.html
Dim strData$
Dim reg As Object
strData = "<p>The winner of the country's third largest lottery jackpot, 258 million yuan ($38.5 million), had yet to come forward by late Wednesday.</p>" & vbCrLf & _
"<!--end 848400-159283-1-->" & vbCrLf & _
"</div>" & vbCrLf & _
"<p>A rocket attack in the Yemeni capital Sanaa on Wednesday targeted a vehicle carrying the deputy chief of the British mission in Yemen and a gunman opened " & vbCrLf & _
"fire at an Austrian oil and gas firm, killing a Frenchman.</p>" & vbCrLf & _
"<!--end 848401-159283-1-->" & vbCrLf & _
"</div>"
Set reg = CreateObject("vbscript.regexp")
reg.Global = True
reg.IgnoreCase = True
reg.Pattern = "<.*?>"
Debug.Print reg.Replace(strData, "")
End Sub点击左上角的“结贴”按钮