Regular Expressions 101

Community Patterns

There does not seem to be anything here

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

~
(?:(\w+)://)?(?:(\w+)\:(\w+)@)?([^/:]+)?(?:\:(\d*))?([^#?]+)?(?:\?([^#]+))?(?:#(.+$))
~
i

Description

match any type of url and split each part (protocol, domain, page, GET, and ID) in capture groups

Submitted by anonymous - 9 years ago