Domain Extension doubt

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • onequestion
    New Member
    • Dec 2007
    • 8

    Domain Extension doubt

    Hi Friends..
    please tell me how long a domain name extension can be? i know 3 digit extensions like
    .com
    .edu
    .net
    .org
    .mil and so on

    i also know 2+2 extensions like
    co.in
    co.uk
    co.us and so on

    is there any other combinations available?

    Thanks...
  • RedSon
    Recognized Expert Expert
    • Jan 2007
    • 4980

    #2
    Nope, I don't think so.

    Comment

    • onequestion
      New Member
      • Dec 2007
      • 8

      #3
      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

      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.

      Comment

      • RedSon
        Recognized Expert Expert
        • Jan 2007
        • 4980

        #4
        Originally posted by onequestion
        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

        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.
        Not sure, with out using REGEX it seems very difficult indeed.

        Comment

        Working...