Regular Expressions 101

Community Patterns

123...6

Domain Splitter (subdomains, domain, directory, current page)

1

Regular Expression
PCRE2 (PHP >=7.3)

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

Description

To test multiple domains, put a slash (/) at the end of each domain

Submitted by tnarh - a month ago (Last modified a month ago)