To solve a penetration test finding I have to check on the value of a cookie. If the cookie is empty or a specific site, all is well. If it's another site, the cookie value should be emptied, so for example: Cookie [some other text that should not be touched] WASReqURL=https://an.evil.site [possibly more text that should not be touched] In this example https://an.evil.site should be replaced by an empty string. Webserver used is IBM HTTP Server. The rule I want to use in the webserver config is:
RequestHeader edit Cookie "^WASReqURL=<empty or my.sites.url>" ""
I figured out that with
^((?!WASReqURL=http(s|)(%3a|:)(%2a|\/){2}(acc.|)my.site.url)[\s\S])*$
I can check whether the cookie contains a proper value or not, but that doesn't help me with removing the value. Any RegEx guru out there who can point me in the right direction?