cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

cleanup Url Regex for session properties

y_buccellato
Advisor

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://www.google.it

https://google.com

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:

 

google

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

2 REPLIES 2

AlexOsbourn
Dynatrace Helper
Dynatrace Helper

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. 

 

mgome
Helper

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:

 

\.([^\.]*+)