【已解决】请教一下如何不用正则获取11跟℃
本帖最后由 black丶shark 于 2017-5-2 16:01 编辑<div class="weather-two">
<div class="weather-wd" id="wd">11</div>
<div class="weather-wd-top">℃</div>
</div> 擅用搜索,惊喜很多。
http://www.autoitx.com/search.php?searchid=4&orderby=lastpost&ascdesc=desc&searchsubmit=yes (?:\">)([^<]+)</ 回复 3# lpxx
秘书,看好标题,是不用正则。 $a = stringsplit (原始数据,'<div class="weather-wd" id="wd">',1)
$b = stringsplit ($a,'</div>',1) _StringBetween(原始数据,'<div class="weather-wd" id="wd">','</div>') 回复 6# fenhanxue
你好,请问一下这个原始数据是? 回复 7# black丶shark
原始数据 = 你要处理的数据
即:
<div class="weather-two">
<div class="weather-wd" id="wd">11</div>
<div class="weather-wd-top">℃</div>
</div> 回复 8# fenhanxue
这样么?我忘记说了,这个11是动态的
$a = stringsplit ("11",'<div class="weather-wd" id="wd">',1)
$b = stringsplit ($a,'</div>',1)
_StringBetween("℃",'<div class="weather-wd" id="wd">','</div>')
MsgBox(0,"",$a) #Include <String.au3>
$a = '<div class="weather-two">' & @CRLF & _
'<div class="weather-wd" id="wd">11</div>'&@CRLF & _
'<div class="weather-wd-top">℃</div>'&@CRLF & _
'</div>'
$b = _StringBetween($a,'<div class="weather-wd" id="wd">','</div>')
MsgBox(0,'你要的结果',$b) 回复 10# fenhanxue
这个11从网页上获取的是动态的怎么办呢? 回复 4# haijie1223
秘书。。。 回复 12# lpxx
大神,正则的话这样写对么?
Local $data = _INetGetSource("http://m.weather.com.cn/mweather/101070101.shtml")
Local $shishi = StringRegExp($data,'(?:\">)([^<]+)</',1)
MsgBox(0,0,$shishi) 本帖最后由 lpxx 于 2017-4-28 13:52 编辑
回复 13# black丶shark #include <INet.au3>
#Include <Array.au3>
Local $data =BinaryToString(_INetGetSource("http://m.weather.com.cn/mweather/101070101.shtml",False),4)
Local $shishi = StringRegExp($data,'<span>([^<]+)',3)
;~ Local $shishi = StringRegExp($data,'(?:<span>|<b>)([^<]+)',3)
_ArrayDisplay($shishi)
MsgBox(0,0,$shishi) 网页内容发全了。
他要用htmlfile
页:
[1]
2