06 Jun 2022 02:26 PM
Hi,
we are trying to configure a clean up rule for many different urls contained in the "Referer" parameter.
At capture time (for user action properties) we can see those and many other values:
http://yahoo.com
https://www.transatlantic.com
ecc...
we would like to clean up those values from the ".it", ".com", "https://www.", "http://" to transform them in, per example:
yahoo
transatlantic
as of now we have managed to have a partial regex but we are struggling to achieve the desidered result.
Can somebody help out?
Thank you
Solved! Go to Solution.
09 Jun 2022 04:40 PM
Try something like this:
^https?:\/\/w{0,3}\.?(.*)\.[a-zA-Z]{2,63}$
I haven't tried this in Dynatrace but it certainly works in regular regex. It assumes that all URLs will contain either HTTP or HTTPS and ends in a valid TLD between 2 and 63 characters.
09 Jun 2022 07:25 PM
You're not going to be able to isolate the cleanup rule to just .it and .com because of the lack of lookahead in the regex engine. The following will get you the string between the first and second period:
\.([^\.]*+)