The regex problem is that the email address and the name after Registrant are intercepted in the following article, but there are many different situations. how can I write a regular expression? Scenario 1: Registrant: & nbsp; jinmi & nbsp; jinmi8 & nbsp; shenzhen, the question of gu regular expression is that the mailbox in the following article and the name of Registrant: Are there many different situations. how can I write a regular expression?
Case 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
Case 2:
Registrant:
Domain Administrator
Netease.com, Inc
No. 16, Ke Yun Rd Tianhe District
GuangZhou GuangDong 510665
CN
[Email protected] + 86.2085106370 Fax: + 86.2085106370
Case 3:
Registrant:
Zhiyong Duan
Beijing Baidu Netcom Science Technology Co., Ltd.
3F Baidu Campus No. 10 Shangdi 10th Street Haidian District
Beijing 100085
CN
[Email protected] + 86.1059924216 Fax: + 86.1059927435
------ Solution --------------------
PHP code
// Name preg_match_all ('/Registrant: \ s * (\ w + \ s + \ w +)/S', $ str, $ name ); print_r ($ name [1]); // email preg_match_all ('/\ B [\ w _] + @ [\ w \. _] +/M', $ str, $ email); print_r ($ email );