johna
johna

Reputation: 10752

Regular expression to check for cookies with no name

I want to create an IIS rewrite rule that runs for any request where there is a cookie with no name (as Classic ASP can't handle these).

I need a regular expression that looks for an equals sign either at the beginning of the cookie string or after a semi colon, and possibly with white space (space, tab, line feed, carriage return, etc) before it.

(; or beginning)(optional white space)=

I'm crap at regular expressions but here's my proposed one:

^|;\s*=

Is this right, or how would this best be done?

Upvotes: 1

Views: 63

Answers (1)

Avinash Raj
Avinash Raj

Reputation: 174696

You're almost there, just put ^|;\s* inside a group, so that the | OR applies to the both.

(^|;)\s*=

Upvotes: 1

Related Questions