Test, validate and match regular expressions
This PCRE regex parses a URL into its constituent components using named capture groups. It extracts the protocol, domain, file path, query parameters, and fragment (anchor). Note that because the '?' and '#' literals are not optional in this pattern, it will only successfully match URLs that contain both query parameters and a fragment identifier.