From a given string, am trying to replace a pattern such as "sometext.othertext.lasttext" with "lasttext". Is this possible in Java with Regex replace? If yes, how? Thanks in advance.

I tried 

```
"hellow.world".replaceAll("(.*)\\.(.*)", "$2") 

```

which results in world. But, I want to replace any such arbitrary sequence. For instance com.google.code should be replace with code and com.facebook should be replaced with facebook.

Just to add, a test input is: 
***if (com.google.code) then*** 
and the test output should be:
***if (code) then*** 

Thanks.