Regular Expressions 101

Community Patterns

Extract url GET parameters

9

Regular Expression
PCRE (PHP <7.3)

/
(?:\?|\&)(?<key>[\w]+)=(?<value>[\w+,.-]+)(?:\:?)(?<option>[\w,]*)
/
g

Description

Returns key/value pair of a url. Also works with google fonts which has additional information

Submitted by anonymous - 10 years ago