Substring (between characters)

If I have the String, for example - GET /www.google.com HTTP/1.1

and I want to make the host address into a substring (www.google.com), is there a way of using the first and second '/' characters to define this?

I could use indexOf("/")

to find the first bit but there may be several more forward slashes in the string.

I'm concerned that if I use something like that or indexOf("HTTP")

I will end up with possibly the file name too.

i.e. I started with:GET /www.google.com/fileName HTTP/1.1

Or is there a better way?

[630 byte] By [turpierga] at [2007-10-3 1:48:47]
# 1
What about using String.split(" ") ?
ichadderza at 2007-7-14 18:47:08 > top of Java-index,Java Essentials,Java Programming...
# 2
String get = "GET /www.google.com HTTP/1.1";String host = get.replaceAll("^[^/]+/([^/ ]+).*$","$1");
sabre150a at 2007-7-14 18:47:08 > top of Java-index,Java Essentials,Java Programming...
# 3
Thanks guysI'll try these out.
turpierga at 2007-7-14 18:47:08 > top of Java-index,Java Essentials,Java Programming...
# 4
There's another indexOf method that you might find useful.
uncle_alicea at 2007-7-14 18:47:08 > top of Java-index,Java Essentials,Java Programming...