正则的有关问题,截取上面文章里的邮箱和Registrant:后的姓名,但是有好多不同情况,请教正则表达式该如何写
程序员文章站
2022-06-02 10:17:01
...
正则的问题,截取下面文章里的邮箱和Registrant:后的姓名,但是有好多不同情况,请问正则表达式该怎么写?
情况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
情况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
情况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 Fax: +86.1059927435
------解决方案--------------------
情况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
情况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
情况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 Fax: +86.1059927435
------解决方案--------------------
- PHP code
//姓名preg_match_all('/Registrant:\s*(\w+\s+\w+)/s',$str,$name); print_r($name[1]);//邮箱preg_match_all('/\b[\w_]+@[\w\._]+/m',$str,$email); print_r($email);相关文章
相关视频
上一篇: PHP文件搜索程序代码_PHP教程
下一篇: php简单支持中文水印程序代码