return new SessionID(date, cookie.getValue());
String value = cookie.getValue(); Matcher matcher = pattern.matcher(value); if (matcher.matches() && matcher.groupCount()>=1) { value = matcher.group(1); } return new SessionID(date, value);
    public SessionID getIDfromResponse(Response response, int location, String name, String regex) {        Request request = response.getRequest();        if (request == null) {            System.out.println("Request was null?");            return null;        }        URL url = request.getURL();        String dateString = response.getHeader("Date");        Date date;        if (dateString != null) {            date = Util.rfc822(dateString);        } else {            date = new Date();        }        SessionID sessid = null;        if (location==LOCATION_COOKIE) {            String[][] headers = response.getHeaders();            for (int i=0; i<headers.length; i++) {                if (headers[i][0].equals("Set-Cookie")) {                    Cookie cookie = new Cookie(date, url, headers[i][1]);                    if (cookie.getKey().equals(name)) {                        return new SessionID(date, cookie.getValue());                    }                }            }        }        System.out.println("Didn't get an id?");        return null;    }