Community Patterns

Community Library Entry

2

Regular Expression
Created·2017-03-08 06:26
Updated·2023-07-20 23:11
Flavor·PCRE2 (PHP)

/
^(https?\:)\/\/(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$
/
Open regex in editor

Description

The best way to parse URL via Regex. This can be used in javascript, PHP, etc.

Submitted by Ivijan-Stefan Stipic