Community Patterns

Community Library Entry

1

Regular Expression
Created·2015-06-03 17:33
Flavor·PCRE (Legacy)

/
(http|https)\:\/\/(?:(.+?)(?:\:(.+?))?\@)?((?:[\w-]+\.)+)([A-Za-z0-9]+)(?:\:(\d{2,5}))?((?:\/[\w-%.]*)+)?(\?(?:[\w-%&="'+,]+)?)?(\#(?:[^#]+)?)?
/
Open regex in editor

Description

Gets all parts of URL including port, username, password, fragment, query, and path

Submitted by Vihan Bhargava