PROPERTY[WHOISDATA][0]= Whois Server Version 1.0 Domain names can now be registered with many different competing registrars. Go to PROPERTY[OWNERCONTACT0EMAIL][0]
就是取PROPERTY[WHOISDATA][0]=和PROPERTY[OWNERCONTACT0EMAIL][0]中间的值出来怎么匹配呀?preg_match_all("/PROPERTY\[WHOISDATA\]\[[0]\].?=([\w]+)/is",$string,$arr);我这样貌似不行
就是取PROPERTY[WHOISDATA][0]=和PROPERTY[OWNERCONTACT0EMAIL][0]中间的值出来怎么匹配呀?preg_match_all("/PROPERTY\[WHOISDATA\]\[[0]\].?=([\w]+)/is",$string,$arr);我这样貌似不行
$pat = '#PROPERTY\[WHOISDATA\]\[0\]((?:(?!PROPERTY\[OWNERCONTACT0EMAIL\]\[0\]).)*)PROPERTY\[OWNERCONTACT0EMAIL\]\[0\]#is';
preg_match($pat,$str,$m);
print_r($m[1]);
PROPERTY[WHOISDATA][0]=和PROPERTY[OWNERCONTACT0EMAIL][0]之间
有可能含有PROPERTY[WHOISDATA][0]或者PROPERTY[OWNERCONTACT0EMAIL][0] ???
你自己整理下规则吧。。
PROPERTY[WHOISDATA][0]= abc PROPERTY[OWNERCONTACT0EMAIL][0] PROPERTY[OWNERCONTACT0EMAIL][0]
bcd PROPERTY[OWNERCONTACT0EMAIL][0] efg PROPERTY[OWNERCONTACT0EMAIL][0] ROPERTY[WHOISDATA][0]= www
PROPERTY[OWNERCONTACT0EMAIL][0]'那么你想要取哪些?
首先你得大体摸清楚你的字符串的规律,比如PROPERTY[WHOISDATA][0]是不是最开始的时候后面才带有=号,还是包含在中间的也带有=号。。摸清楚大概规律才好上正则。没有规则何来正则。
那么应该很简单啊。
'#PROPERTY\[WHOISDATA\]\[0\](.*?)PROPERTY\[OWNERCONTACT0EMAIL\]\[0\]#is'都可以出来了 $str = <<<STR
PROPERTY[WHOISDATA][0]= Whois Server Version 1.0 Domain names can now be registered with many different competing registrars. Go to http://registrar.verisign-grs.com/whois/ for detailed information. Domain Name: IZB.CC Registrar: 1 API GMBH Whois Server: whois.1api.net Referral URL: http://www.1api.net Name Server: FREE01.EDITDNS.NET Name Server: FREE02.EDITDNS.NET Status: ACTIVE Updated Date: 13-may-2010 Creation Date: 02-oct-2009 Expiration Date: 02-oct-2010 >>> Last update of whois database: Tue, 1 Jun 2010 20:02:28 EDT <<< NOTICE: The expiration date displayed in this record is the date the registrar's sponsorship of the domain name registration in the registry is currently set to expire. This date does not necessarily reflect the expiration date of the domain name registrant's agreement with the sponsoring registrar. Users may consult the sponsoring registrar's Whois database to view the registrar's reported date of expiration for this registration. TERMS OF USE: You are not authorized to access or query our Whois database through the use of electronic processes that are high-volume and automated except as reasonably necessary to register domain names or modify existing registrations; the Data in VeriSign's ("VeriSign") Whois database is provided by VeriSign for information purposes only, and to assist persons in obtaining information about or related to a domain name registration record. VeriSign does not guarantee its accuracy. By submitting a Whois query, you agree to abide by the following terms of use: You agree that you may use this Data only for lawful purposes and that under no circumstances will you use this Data to: (1) allow, enable, or otherwise support the transmission of mass unsolicited, commercial advertising or solicitations via e-mail, telephone, or facsimile; or (2) enable high volume, automated, electronic processes that apply to VeriSign (or its computer systems). The compilation, repackaging, dissemination or other use of this Data is expressly prohibited without the prior written consent of VeriSign. You agree not to use electronic processes that are automated and high-volume to access or query the Whois database except as reasonably necessary to register domain names or modify existing registrations. VeriSign reserves the right to restrict your access to the Whois database in its sole discretion to ensure operational stability. VeriSign may restrict or terminate your access to the Whois database for failure to abide by these terms of use. VeriSign reserves the right to modify these terms at any time. The Registry database contains ONLY .cc, .tv, and .jobs domains and Registrars. PROPERTY[WHOISDATA][1]=; This data is provided by HEXONET Services Inc. ; for information purposes, and to assist persons obtaining information ; about or related to domain name registration records. ; HEXONET Services Inc. does not guarantee its accuracy. ; By submitting a WHOIS query, you agree that you will use this data ; only for lawful purposes and that, under no circumstances, you will ; use this data to ; 1) allow, enable, or otherwise support the transmission of mass ; unsolicited, commercial advertising or solicitations via E-mail ; (spam); or ; 2) enable high volume, automated, electronic processes that apply ; to this WHOIS server. ; These terms may be changed without prior notice. ; By submitting this query, you agree to abide by this policy. DOMAIN: IZB.CC RSP: HEXONET Services Inc. URL: http://www.HEXONET.net created-date: 2009-10-02 08:26:42 updated-date: 2010-05-13 12:41:14 registration-expiration-date: 2010-10-02 08:26:44 owner-organization: Liu Zhe owner-name: Liu Zhe owner-street: ZiBo Qu owner-city: ZiBo owner-state: ShanDong owner-zip: 255000 owner-country: CN owner-phone: +86.13864312581 owner-fax: +86.13864312581 owner-email: [email protected] admin-organization: Liu Zhe admin-name: Liu Zhe admin-street: ZiBo Qu admin-city: ZiBo admin-state: ShanDong admin-zip: 255000 admin-country: CN admin-phone: +86.13864312581 admin-fax: +86.13864312581 admin-email: [email protected] tech-organization: Liu Zhe tech-name: Liu Zhe tech-street: ZiBo Qu tech-city: ZiBo tech-state: ShanDong tech-zip: 255000 tech-country: CN tech-phone: +86.13864312581 tech-fax: +86.13864312581 tech-email: [email protected] billing-organization: Liu Zhe billing-name: Liu Zhe billing-street: ZiBo Qu billing-city: ZiBo billing-state: ShanDong billing-zip: 255000 billing-country: CN billing-phone: +86.13864312581 billing-fax: +86.13864312581 billing-email: [email protected] nameserver: free01.editdns.net nameserver: free02.editdns.net ; Be Your Own Services Provider ; Domains, DNS, SSL Certs and much more ... PROPERTY[OWNERCONTACT0EMAIL][0]';
STR;
$pat = '#PROPERTY\[WHOISDATA\]\[0\](.*)PROPERTY\[OWNERCONTACT0EMAIL\]\[0\]#is';
preg_match($pat,$str,$m);
print_r($m[1]);
exit();