Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
(?<Address>(?<Protocol>https?:\/\/)?(?<Subdomain>\w*\.)?(?<Domain>(?:[a-z0-9\-]{2,})\.(?:[^\s\/\.]{2,}))(?<Path>\/[^\s\?]*)?(?<Params>(?:\?|\#)[^\s\/\?\:]*)?)
/
gi

Description

Get every part of a link

Submitted by Ricardo Boss (MCMainiac) - 9 years ago