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

regex in Dynatrace to grab last item from /item1/item2/last_item

henk_stobbe
DynaMight Champion
DynaMight Champion

Hello,

 

Without getting greedy (-; who knows how to solve below,

 

/item1/item2/last_item  should transform to last_item

 

Who can solve this, non greedy (and yes I know it is a lame joke)

 

KR Henk 

 

 

 

 

 

4 REPLIES 4

Julius_Loman
DynaMight Guru
DynaMight Guru

The following should work, does it?  

/([^/]*+)$

 

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

Hi Julius,

 

(you missed an escape so  change to ([^\/]*+)$   )

 

"Dynatrace says to expensive!"  but after a lot of tries it seems that the solution is super simple,

                  (when you see it (-;)

 

[a-z,A-Z]+$ (or a variation of course)

 

KR Henk

 

KR Henk

No, my regex ix fine I think. You need to specify the head / as without it it's expensive. Also it depends on where within Dynatrace you are using it.
It works for the request naming rules (using the aaa placeholder):

Julius_Loman_0-1658417403400.png


RUM has different regex limits, so it's better to ask where you need it exactly.

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

henk_stobbe
DynaMight Champion
DynaMight Champion

Hello Julius,

 

Customer was using regex in calculated metric, so you are right yours works perfect.

 

(except in calculated metric than mine is better (-;) 

henk_stobbe_0-1658835498777.png

And yes I know that is very deep (-;

 

Thank for your reaction!

 

KR Henk