java - how to extract this using regex -


i need extract this

example:

 www.google.com  maps.google.com  maps.maps.google.com 

i need extraact google.com this.

how can in java?

split on . , pick last 2 bits.

    string s = "maps.google.com";     string[] arr = s.split("\\.");     //should check size of arr here     system.out.println(arr[arr.length-2] + '.' + arr[arr.length-1]); 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -