rather than parse the string, use java.net.*??? (or GWT equiv) to parse the URL, then write your logic to use the fields returned by the library.