Regular Expressions 101

Parse Entire URL

Open Workspace
  • PCRE (Legacy)
  • Match
1

Regular Expression

/
https?:\/\/(?:www\.)?([-a-zA-Z0-9@:%._\+~#=]{2,256})(\.[a-z]{2,6}\b)*(\/[\/\d\w\.-]*)*(?:[\?])*(.+)*
/
gi

Description

This regex is a mashup that strips protocol, domain and URI into seperate capture groups.

Submitted by Robert Kozora