Regular Expressions 101

Community Patterns

Get domain minus TLD from referer URL

0

Regular Expression
PCRE (PHP <7.3)

/
^https?:\/\/(?:.*\.)?(.*?)\..*
/
gm

Description

This is not 100% but if you just need for example a loose guess how many impressions are referred from a search engine and don't want to track specific locales (google.com, google.cn, google.in, etc) you can just compare against a much smaller list (google, bing, duckduckgo, etc) Separate group for TLD.

Submitted by anonymous - 5 years ago