But what is this website:-( http://www2.austin.cc.tx.us/
I want to exactly retrieve the domain name like "austin" in http://www2.austin.cc.tx.us
yahoo from www.mail.yahoo.com // It is in 2nd position
austin from www2.austin.cc.tx.us // It is in 1st position
abc from www.xyz.qwerty.abc.efg.co.in // It is in 3rd position
is there any methods available in java?
actually now i am using this code
- private String getDomain(URL url)
-
{
-
String domain;
-
Pattern p = Pattern.compile("[.]");
-
String s[]=p.split(url.getAuthority());
-
if(s[(s.length-1)].length()==2)
-
domain = s[s.length-3];
-
else
-
domain = s[s.length-2];
-
return domain;
-
}
but it will work to retrieve domain only for 3digit country specific domain and 2 + 2 country specific domain. please help it is the important part in my project.