Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
(?<content>(?<type>.+?)\/(?<sub>.+?)(?:\+(?<suffix>.+?))?)(?:;.*?(?:q=(?<weight>[.\d]+))?.*?)?(?:,|$)
/
gm

Description

Parse the Accept request HTTP header advertises which content types, expressed as MIME types,

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept

Submitted by anonymous - 6 years ago