Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
(?:http[s]*\:\/\/)*(?<dstdomain>\w*[\-]*\w*\.[a-zA-Z]*)(?:$|\:.*|\/.*)
/
gm

Description

From native squid logs, I retrieve url with http* or not. I use the regex to extract the top domain from the url and store it into a variable

Submitted by anonymous - 6 years ago