Regular Expressions 101

Community Patterns

url matcher 2.0

-1

Regular Expression
PCRE2 (PHP >=7.3)

/
^(?<scheme>[a-z]+:\/\/)(?:(?<username>[^\/:@]+)(?::(?<password>[^\/:@]+))?@)?(?<host>[^\/]+)(?:(?<path>\/[^?#]+)(?:(?<query>[^#]+)?)?(?:#(?<fragment>.*))?)?
/
gm

Description

now matches any protocol, as well as username, password, query and fragment. query is not split

Submitted by Mitsunee - 10 months ago