Regular Expressions 101

Community Patterns

Community Library Entry

3

Regular Expression
PCRE (PHP <7.3)

/
(?'location'.+)(?:\/(?'resource'[\w\-\._]+\.js))(?:\?(?'params'.+))?
/
gm

Description

Extract resource location, name and query parameters from a URL

Submitted by cebence - 10 years ago