Regular Expressions 101

Extract domain from URL

Open Workspace
  • PCRE (Legacy)
  • Match
1

Regular Expression

/
(www.|https?:\/\/(?:www.)?)?([a-z-_0-9]*)(?:\.)
/
gm

Description

'www .xakep.ru' === xakep 'http://github.com/carbonfive/raygun' === github 'https://www.**cnet**.com ' === cnet 'xewveqmwcz90sl64.co/' === xewveqmwcz90sl64

Submitted by Anonymous