Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^(?:(?'scheme'http[s]?):\/\/)?(?'host'[a-z0-9_\-.]+)(?:\:(?'port'[0-9]+))?(?'path'\/[^\?\s]*)?(?:\?(?'query'\S+))?
/
gm

Description

scheme host port path query

Submitted by anonymous - 2 years ago