Removing all, but not all cookies

In some cases, you might want to remove only a few, selected cookies, for example if you use Google Analytics.

Currently, this has to be done using regular expressions as follows:

sub vcl_recv {
    # Is it the first one?
    set req.http.cookie = regsub(req.http.cookie, "foo=[^;]+(; )?", "");

    # Or perhaps one in the middle or the last one?
    set req.http.cookie = regsub(req.http.cookie, "(; )?foo=[^;]+", "");
    if (req.http.cookie ~ "^ *$") {
        remove req.http.cookie;
    }
}

Replace foo with the name of the cookie you wish to remove.