vbs如何提取文本中指定字符串中间的内容?

<span class="red">aaa</span>
<span class="red">bbbbbb</span>
<span class="red">ccccc</span>
<span class="red">dddddddddd</span>

在一个txt文本中,有很多这样的内容,我现在需要提取<span class="red">和</span>中间的内容,也就是aaa、bbbbbb、ccccc、dddddddddd,并把这些内容一行一行的写入到另一个txt文本中,用vbs代码应该怎么写?谢谢各位高手

txtLeft="("txtRight=")"Set fso=CreateObject("Scripting.Filesystemobject")For each i In WScript.ArgumentsIf len(fso.OpenTextFile(i,1).ReadAll) > Len(txtLeft & txtRight) thenSet wb=fso.OpenTextFile(i & ".txt",2,true)For Each ii In quzhidingwenben(fso.OpenTextFile(i,1).ReadAll,txtLeft,txtRight)wb.WriteLine iiNextwb.CloseEnd ifNext Function quzhidingwenben(text,text1,text2)text=Right(text,Len(text)-InStr(text,text1)+1)Do While InStr(text,text1)>0 And InStr(text,text2)>InStr(text,text1)n1= InStr(text,text1)+ Len(text1)-1text=Right(text,Len(text)-n1)n2=InStr(text,text2)text0=text0 & Left(text,n2-1) & "," text=Right(text,Len(text)-n2+1)text=Right(text,Len(text)-InStr(text,text1)+1)LoopIf text0<>"" then quzhidingwenben=Split(Left(text0,Len(text0)-1),",") Else quzhidingwenben=Split("",",")End function
'看你长时间没人回复,我给你写了一个,把最上边两行的括号换成你需要的文本就行。
温馨提示:答案为网友推荐,仅供参考
相似回答