Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
^(?:(?:(?:([^:\/\/]+):)?\/\/)?(?:([\w\-.@]+)(?::(.*))?@)?([\w-.]+)(?::([0-9]+))?)?(?:(\/.*?\/?)(?:([\w-.]+))?)?(?:\?([^#]*))?(?:#(.*))?$
/
gmi

Description

Parse url with any complexity

Submitted by Bohdanov Mikhail - 9 years ago