Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
\s*([a-z]{2})(?:-[A-Z]{2})?(?:\s*;q=([0-9]\.[0-9]))?(?:\s*,|$)
/
gi

Description

parses accept language http header groups:

  1. language code iso-693-1 without country specification
  2. preference quality value
Submitted by schunka - 7 years ago