-1
我有一百個不同頂級域名(.com,.se,.uk,.cz等)的Whois文件。每種都有不同的格式。我的主要任務是提取註冊商,註冊人,截止日期,更新日期等信息。以下代碼適用於com。淨。 org & info。我正在使用Java SE 6.正則表達式提取數據
Admin contact: "\\bAdmin\\sEmail:\\s*\\w+\\-*\\w*\\.*\\w*@\\w+(\\.\\w+)+"
Technical contact: "\\bTech\\sEmail:\\s*\\w+\\-*\\w*\\.*\\w*@\\w+(\\.\\w+)+"
Whois Registrant: "\\bRegistrant\\sName:\\s*\\w+\\-*\\.*\\w+\\s*\\w*"
Registrar: "\\bRegistrar:\\w+\\.*\\w*"
Registered on Date: "\\bCreation\\sDate:\\s*\\d+-\\d+-\\d+T\\d+:\\d+:\\d+Z"
Expiry Date: "\\bExpiry\\sDate:\\s*\\d+-\\d+-\\d+T\\d+:\\d+:\\d+Z"
Updated Date: "\\bUpdated\\sDate:\\s*\\d+-\\d+-\\d+T\\d+:\\d+:\\d+Z"
Name Servers: "\\bName\\sServer:\\s*\\w+\\d*\\.*\\w*\\-*\\w*(\\.\\w+)+"
Registrant Status: "\\bDomain\\sStatus:\\s*\\w+"
如何爲其他頂級域名的上述各點添加替代方案。例如: 我想要有名稱服務器:
"\\bName\\sServer:\\s*\\w+\\d*\\.*\\w*\\-*\\w*(\\.\\w+)+"
OR
alternative pattern
OR
alternative Pattern
它可行嗎?如果沒有,還有其他方法嗎?
號感謝。將嘗試並回來。 – 2014-09-01 06:23:54