正則的有關問題,截取上面文章裡的郵箱和Registrant:後的姓名,但是有好多不同情況,請教Regex該如何寫

來源:互聯網
上載者:User
正則的問題,截取下面文章裡的郵箱和Registrant:後的姓名,但是有好多不同情況,請問Regex該怎麼寫?
情況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);
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.