Regular Expressions 101

Community Library Entry

2

Regular Expression
PCRE (PHP <7.3)

/
(?:http\:\/\/(?:www\.)?){1}[^\/]*\/([^\/]*)(?#parameter2)(?:\/([^\/]*))?(?#parameter3)(?:\/([^\/]*))?(?#parameter4)(?:\/([^\/]*))?
/

Description

Gets the parameters (how many you want) from a url and organize into groups

Submitted by Caio Oliveira - 11 years ago