本帖最后由 lpxx 于 2014-5-14 21:44 编辑 #include <Array.au3>
Local $Str = _
'<li data-cmd="0" data-ptime="2014-05-14 19:00:00" data-cname="国内" data-pname="新闻" _hot="live.souhu.newellist" data-playid="222445654" data-index="1" data-key="34">' & @CRLF & _
'<img onerror="picerr(this,3)" data-src="http://www.baidu。com/newsapp_ls/0/11987379_3030/0"/>' & @CRLF & _
'<span>安徽新闻</span>' & @CRLF
MsgBox(0, '原字符串', $Str)
Local $Test = StringRegExp($str, 'data-(?:cname|playid)="([^"]+)', 3)
If Not @Error Then MsgBox(0, '匹配数量: ' & UBound($Test), '其中[0]元素为: ' & $Test[0])
_ArrayDisplay($Test, UBound($Test))
就这点能耐,坐等afan大神答案。 |