Regular problem, intercept the following article in the mailbox and registrant: After the name, but there are a lot of different situations, how to write the regular expression?
Scenario 1:
Registrant:
Jin mi
Jin Mi 8
Shen Zhen, Guang Dong 518000
China
Registered through:GoDaddy.com, LLC (http://www.godaddy.com)
Domain name:760pk.com
Created on:04-may-12
Expires on:04-may-13
Last Updated on:28-jun-12
Administrative Contact:
Mi, Jin [email protected]
Jin Mi 8
Shen Zhen, Guang Dong 518000
China
+86.13510187966
Technical Contact:
Mi, Jin [email protected]
Jin Mi 8
Shen Zhen, Guang Dong 518000
China
+86.13510187966
Scenario 2:
Registrant:
Domain Administrator
Netease.com, Inc.
No.16, Ke Yun Rd Tianhe District
GuangZhou Guangdong 510665
CN
[Email protected] +86.2085106370 传真: +86.2085106370
Scenario 3:
Registrant:
Zhiyong Duan
Beijing Baidu netcom Science Technology Co., Ltd.
3F Baidu Campus No.10 shangdi 10th Street Haidian District
Beijing Beijing 100085
CN
[Email protected] +86.1059924216 传真: +86.1059927435
------Solution--------------------
PHP code
//name Preg_match_all ('/registrant:\s* (\w+\s+\w+)/s ') , $str, $name); Print_r ($name [1]);//Mailbox Preg_match_all ('/\b[\w_]+@[\w\._]+/m ', $str, $email); Print_r ($email);