Removing a Cookie value using regex

I am trying to remove a cookie value by using the following:

http-request replace-header Cookie (;?\ ?sessionid=[^;];?\ ?)(.|\r\n) \2

If I have read the docs correctly this will find the ‘sessionid’ cookie value in the Cookie header and replace it with whatever comes after it, whether it is a string or a ‘\r\n’.

This appears to work, for the most part, but there are times that it also removes the values before it.

  1. what am I doing wrong???
  2. is there another way to do this??


1 Like