I got this simple code:
String ip = \"1.2.3.4\"; String[] ipArray = ip.split(\".\"); System.out.println(ipArray[1]);
And ipArray
ipArray
Pattern.quote(String) can also be used to quote the whole string. This returns a pattern which will be interpreted literally, special characters will have no special meaning. This might be overkill in this case, but sometimes it can be useful.