Regular Expressions 101

Community Patterns

URL name and domain

0

Regular Expression
PCRE (PHP <7.3)

/
^https?:\/\/[w\d.]*([\S][^\/]+)
/

Description

Extracts the name and domain of any link, for instance https://www.google.com/?gfe_rd=cr&#q=generic+search --> google.com

Submitted by Sergio - 9 years ago