找回密码
 加入
搜索
查看: 5719|回复: 8

[IE类操作] [已解决]关于使用正则表达式提取返回网页中关键字符串所在行的问题

  [复制链接]
发表于 2015-3-13 15:01:32 | 显示全部楼层 |阅读模式
本帖最后由 白杨 于 2015-3-16 16:15 编辑
<pre>   Domain Name: BAIDU.COM
   Registrar: MARKMONITOR INC.
   Sponsoring Registrar IANA ID: 292
   Whois Server: whois.markmonitor.com
   Referral URL: http://www.markmonitor.com
   Name Server: DNS.BAIDU.COM
   Name Server: NS2.BAIDU.COM
   Name Server: NS3.BAIDU.COM
   Name Server: NS4.BAIDU.COM
   Name Server: NS7.BAIDU.COM
   Status: clientDeleteProhibited http://www.icann.org/epp#clientDeleteProhibited
   Status: clientTransferProhibited http://www.icann.org/epp#clientTransferProhibited
   Status: clientUpdateProhibited http://www.icann.org/epp#clientUpdateProhibited
   Status: serverDeleteProhibited http://www.icann.org/epp#serverDeleteProhibited
   Status: serverTransferProhibited http://www.icann.org/epp#serverTransferProhibited
   Status: serverUpdateProhibited http://www.icann.org/epp#serverUpdateProhibited
   Updated Date: 14-oct-2013
   Creation Date: 11-oct-1999
   Expiration Date: 11-oct-2015

>>> Last update of whois database: Wed, 11 Mar 2015 15:57:28 GMT <<<
</pre>
<p>Queried <span class="ipaddr">whois.markmonitor.com</span> with "<span class="ipaddr">baidu.com</span>"...</p>
<pre>Domain Name: baidu.com
Registry Domain ID: 11181110_DOMAIN_COM-VRSN
Registrar WHOIS Server: whois.markmonitor.com
Registrar URL: http://www.markmonitor.com
Updated Date: 2014-08-20T04:00:52-0700
Creation Date: 1999-10-11T04:05:17-0700
Registrar Registration Expiration Date: 2015-10-11T04:05:17-0700
Registrar: MarkMonitor, Inc.
Registrar IANA ID: 292
Registrar Abuse Contact Email: abusecomplaints@markmonitor.com
Registrar Abuse Contact Phone: +1.2083895740
Domain Status: clientUpdateProhibited (https://www.icann.org/epp#clientUpdateProhibited)
Domain Status: clientTransferProhibited (https://www.icann.org/epp#clientTransferProhibited)
Domain Status: clientDeleteProhibited (https://www.icann.org/epp#clientDeleteProhibited)
Registry Registrant ID: 
Registrant Name: Zhiyong Duan
Registrant Organization: Beijing Baidu Netcom Science Technology Co., Ltd.
Registrant Street: 3F Baidu Campus No.10, Shangdi 10th Street Haidian District
Registrant City: Beijing
Registrant State/Province: Beijing
Registrant Postal Code: 100085
Registrant Country: CN
Registrant Phone: +86.1059924216
Registrant Phone Ext: 
Registrant Fax: +86.1059927435
Registrant Fax Ext: 
Registrant Email: domainmaster@baidu.com
Registry Admin ID: 
Admin Name: Zhiyong Duan
Admin Organization: Beijing Baidu Netcom Science Technology Co., Ltd.
Admin Street: 3F Baidu Campus No.10, Shangdi 10th Street Haidian District
Admin City: Beijing
Admin State/Province: Beijing
Admin Postal Code: 100085
Admin Country: CN
Admin Phone: +86.1059924216
Admin Phone Ext: 
Admin Fax: +86.1059927435
Admin Fax Ext: 
Admin Email: domainmaster@baidu.com
Registry Tech ID: 
Tech Name: Zhiyong Duan
Tech Organization: Beijing Baidu Netcom Science Technology Co., Ltd.
Tech Street: 3F Baidu Campus No.10, Shangdi 10th Street Haidian District
Tech City: Beijing
Tech State/Province: Beijing
Tech Postal Code: 100085
Tech Country: CN
Tech Phone: +86.1059924216
Tech Phone Ext: 
Tech Fax: +86.1059927435
Tech Fax Ext: 
Tech Email: domainmaster@baidu.com
Name Server: ns3.baidu.com
Name Server: ns7.baidu.com
Name Server: dns.baidu.com
Name Server: ns4.baidu.com
Name Server: ns2.baidu.com
DNSSEC: unsigned
URL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/
>>> Last update of WHOIS database: 2015-03-11T08:50:20-0700 <<<
</pre>
这是我用IE.au3中的$oHTTP.responseText获得的部分网页的源码,源码如下
$return=BinaryToString($oHTTP.responseText)
$a = StringRegExp($return,'\Registrant Street:(.+?)\ & @CRLF', 1)
我现在想提取出诸如Admin Name后面的信息并显示出来,刚学autoit的小白,看来大神们的帖子看了半天也才把网页返回回来,剩下的就两眼一抹黑了。
 楼主| 发表于 2015-3-13 15:56:52 | 显示全部楼层
我贴的代码太长了,其实就是解决一个用正则表达式来获取每行相应信息的问题
发表于 2015-3-13 17:41:07 | 显示全部楼层
我不是很理解,你具体想要哪些内容。。
发表于 2015-3-13 17:50:03 | 显示全部楼层
我不是很理解,你具体想要哪些内容。。
半芯竹 发表于 2015-3-13 17:41



.Admin Name: Zhiyong Duan    他想要的应该是这个 ,正则太难了....
发表于 2015-3-13 18:18:44 | 显示全部楼层
回复 4# Huiseyu


    那就更简单了。。Admin Name: (.*)  这样就完了。
应该不止是这样,其它信息他还想要的。。
发表于 2015-3-13 18:21:26 | 显示全部楼层
Admin Name:\s(.*?)\n
 楼主| 发表于 2015-3-16 09:45:17 | 显示全部楼层
回复 6# haijie1223


   用msgbox返回是1?
 楼主| 发表于 2015-3-16 09:50:23 | 显示全部楼层
回复 6# haijie1223


#include <IE.au3>
#include <Array.au3>
$oHTTP = ObjCreate("microsoft.xmlhttp")
$oHTTP.Open("post","http://centralops.net/co/DomainDossier.aspx",false)
$oHTTP.setRequestHeader("Cache-Control", "no-cache")
$oHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded")  
$oHTTP.setRequestHeader("Referer","http://centralops.net/co/body")
$oHTTP.setRequestHeader("Accept-Encoding","gzip, deflate")
$oHTTP.setRequestHeader("User-Agent","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0) Gecko/20100101 Firefox/36")
$oHTTP.Send("addr=google.com&go.x=12&go.y=12&dom_dns=1&dom_whois=1&net_whois=1")
$return=BinaryToString($oHTTP.responsebody)
$array = StringRegExp($return, 'Admin Name:\s(.*?)\n',1)
_ArrayDisplay($array,"_ArrayDisplay() Test")
使用了arraydisplay返回值居然是DNS Admin
发表于 2015-4-6 12:06:11 | 显示全部楼层
具体想要哪些内容。。/???
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-12-22 10:46 , Processed in 0.082374 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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