找回密码
 加入
搜索
查看: 2202|回复: 3

[效率算法] 请教:Microsoft 网页源码正则提取数据问题

[复制链接]
发表于 2013-10-19 13:25:29 | 显示全部楼层 |阅读模式
<div id="Div_ProductNameDynamic" style="width:165px;"; class="paddingtop4 fontNameSegoeUI fontsize12 color3f3f3f fontweightbold">
                        Windows Server 2008
                    </div>
                    <div class="paddingtop4"><!--Akshay Mehta : Making Key: localized as required in Issue 42140-->
                   <div> <span id="ctl00_ctl00_ContentPlaceHolder1_StudentBody_DataList_UserProductsNew_ctl00_Label_SerialKey" class="fontNameSegoeUI fontsize12 color858585">密钥: 84CVF-7WT83-GWJHK-2XWGW-P26F3</span>  </div>
                           <div><span id="ctl00_ctl00_ContentPlaceHolder1_StudentBody_DataList_UserProductsNew_ctl00_LanguageLabel" class="fontNameSegoeUI fontsize12 color858585">语言: English</span></div>
                    <div><span id="ctl00_ctl00_ContentPlaceHolder1_StudentBody_DataList_UserProductsNew_ctl00_VersionLabel" class="fontNameSegoeUI fontsize12 color858585">版本: Standard with SP 2 32-bit</span></div>
                    <div><span id="ctl00_ctl00_ContentPlaceHolder1_StudentBody_DataList_UserProductsNew_ctl00_Label_OrderNumber" class="fontNameSegoeUI fontsize12 color858585">订单编号:100203702119</span></div>
    
                   
                    </div>
                    <div class="paddingtop1">

                        <a id="ctl00_ctl00_ContentPlaceHolder1_StudentBody_DataList_UserProductsNew_ctl00_LinkButton_CopyKey" class="fontNameSegoeUI fontsize11 fontweightbold color3783d2 textdecorationnone" href="javascript:__doPostBack('ctl00$ctl00$ContentPlaceHolder1$StudentBody$DataList_UserProductsNew$ctl00$LinkButton_CopyKey','')" style="display:none;">将密钥复制到剪贴板</a>
                    </div>
我想要提取的数据是:Windows Server 2008和84CVF-7WT83-GWJHK-2XWGW-P26F3和Standard with SP 2 32-bit
发表于 2013-10-19 15:06:27 | 显示全部楼层
$Result = StringRegExp($HTML, '<div id="Div_ProductNameDynamic".*?>([\S\s]*?)<\/div>', 3)
$Result[0]
结果:Windows Server 2008

$Result = StringRegExp($HTML, '<span.*?>密钥:\s+(.*?)<\/span>', 3)
$Result[0]
结果:84CVF-7WT83-GWJHK-2XWGW-P26F3

$Result = StringRegExp($HTML, '<span.*?>版本:\s+(.*?)<\/span>', 3)
$Result[0]
结果:Standard with SP 2 32-bit
发表于 2013-10-19 15:12:46 | 显示全部楼层
回复 1# lsszmj
'(?is)id="Div_ProductNameDynamic[^>]+>([^<>]+)<.+密钥:\h*([^<>]+)<.+版本:\h*([^<>]+)<'
发表于 2013-10-19 16:03:53 | 显示全部楼层
回复 3# user3000


   写一起了,好复杂,还不会呢,努力学习中。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-3 15:29 , Processed in 0.089694 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表