The expression failed to match because there was not enough memory available.

We've been using URL Rewrite 2.x (v7.2.1980) to remove unwanted cookie values (in this case BadFood) as requests come in. This inbound rule is setup under Conditions with an Input of {HTTP_COOKIE} and a pattern like:

This has been working fine with v7.2.1980. However, when we updated to v
7.2.1993 (the most recent release as of this post), Failed Request Tracing shows this Error

ModuleName IIS Web Core

Notification PRE_BEGIN_REQUEST

HttpStatus 500

HttpReason URL Rewrite Module Error.

HttpSubStatus 51

ErrorCode 2152071481

ConfigExceptionInfo

ErrorDescription The expression "^(.*?)((?:BadFood\d*?=[^;\s]+[;\s]+)+)(.*)$" failed to match because there was not enough memory available.

ModuleName RewriteModule

NotificationStatus NOTIFICATION_HANDLED

In the URL Rewrite Expression Test Pattern screen inside of IIS Manager, I also get an error after clicking Test: "The expression did not match because there was not enough memory available." Interestingly, if a single character is removed in the sample
data (one 'a' in my test), the test pattern works.

Any ideas about what changed between v 7.2.1980 and 7.2.1993 that might cause this?

MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

Re: The expression failed to match because there was not enough memory available.

Trying to understand; the Microsoft link mentioned refers to a June 2014 hotfix in version 2.0 of URL Rewrite. We're using URL Rewrite version 2.1 which (while I could certainly be wrong) I expect includes the hotfix.

It was mentioned that the

Jalpa Panchal

rule does not match all the value of the variable,try to set proper regular expression that match your requirement

Any thoughts on what part of the regular expression is improper? It appears to match the cookie values and works great until the cookie grows to the size in the given example. On a test system, if a single character is removed from the given example data,
everything works just fine.

Also, note that everything was working great in URL Rewrite 2.1 v7.2.1980 which was the current version as of September 2018 (and perhaps later) it's just
when we updated to URL Rewrite 2.1 v7.2.1993 that things stopped working correctly.

Any suggestions or insight is most welcome; thanks again for taking the time to reply!

MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.