Regular Expressions 101

Community Patterns

Domain from URL

1

Regular Expression
PCRE (PHP <7.3)

/
.+\/\/|www.|\..+
/
g

Description

Matches everything before after // or www and before a period.

If needed, replace the matched elements with blanks.

Submitted by anonymous - 3 years ago