Webflags: g
Cookie Header Value
Parse name=value pairs from an HTTP `Cookie:` header value.
Try it in RegexPro →Available in
Pattern
regexengine-agnostic
([^=;\s]+)=([^;]+) (flags: g)Raw source: ([^=;\s]+)=([^;]+)
How it works
([^=;\s]+) captures the cookie name — characters that aren't equals, semicolon, or whitespace. = is the literal separator. ([^;]+) captures the value — everything up to the next semicolon, allowing spaces and special chars inside the value. Repeats globally to capture every cookie.
Examples
Input
session=abc123; theme=dark; user_id=42Matches
session=abc123theme=darkuser_id=42
Input
single=valueMatches
single=value
Input
no cookiesNo match
—Common use cases
- •Reverse-proxy cookie inspection
- •Auth middleware that parses session cookies
- •Log analysis — extracting tracking cookies
- •Cookie-based feature gating in CDN edge logic
Related patterns
HTTP Content-Type Header
WebParse the value of an HTTP Content-Type header, capturing the media type and optional charset.
HTML Attribute
WebMatch HTML attributes of the form name="value" or name='value' and capture both parts.
HTML5 Color Input Value
WebValidate the value of an HTML5 `<input type="color">` — exactly 6 hex digits with leading hash.
CSS Class from `class=""` Attribute
WebExtract the value of a `class="..."` attribute from raw HTML, handling double or single quotes.