Regular Expressions 101

Community Library

x
  • PCRE (Legacy)
  • Match
1

Regular Expression

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

Description

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

Submitted by Vihan Bhargava