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

Customize request naming with regex extraction rule

diana
Participant

Hi all,

 

Need to create a global request naming rule which will extract everything before the last / and then append <ID> to the resulting name. Having trouble creating a regex pattern that does not break DT's rules (it's either greedy or too expensive). Could someone help out with this one? 

 

Input examples:

 

/URI-A/URI-B/URI-C/URI-D/04w0da444d979e74GSDFGS92f75e0d1e187f9?timestamp=1234
/URI-A/URI-B/URI-C/04w0da444d979e74GSDFGS92f75e0d1e187f9?timestamp=1234

 


Regex Extraction > everything before the last /= {Cleaned-Placeholder}

 

/URI-A/URI-B/URI-C/URI-D/
/URI-A/URI-B/URI-C/​

 

 
Request naming rule = {Cleaned-Placeholder}/<ID>

 

/URI-A/URI-B/URI-C/URI-D/<ID>
/URI-A/URI-B/URI-C/<ID>

 

 

9 REPLIES 9

DanielS
Advisor

Hope that one of these two options help

 

1st option:

 

DanielS_2-1617151868227.png

 

2nd option:

 

DanielS_3-1617151892999.png

 

 

The true delight is in the finding out rather than in the knowing.

Unfortunately, both are invalid options - the second one is greedy and has multiple capture groups which are some of the DT regex restrictions 😞

 

https://www.dynatrace.com/support/help/shortlink/regex#restrictions

 

Hello @diana 

Please try the following:

(?>.+\/)

 

Regards,

Babar

diana_0-1617820120329.png

Hey @Babar_Qayyum , it doesn't like that one either.

Hello @diana 

Please try the following.

(\DURI\D+\W+)

Regards,

Babar

Radu
Dynatrace Pro
Dynatrace Pro

Hi Diana,

 

Try this one...

(.*?\/)[^\/]++\/?$

 

It will extract everything up to and including the final "/" of the URL, and it will be accepted by Dynatrace regex for request naming rules.

Radu_0-1617868462881.png

 

Best regards,

Radu

Hi Radu,


That one is also not accepted:

diana_0-1617982864614.png

 

Radu
Dynatrace Pro
Dynatrace Pro

Sorry, forgot to add the ^ at the beginning:

^(.*?\/)[^\/]++\/?$

 

Awesome, that works! Thanks Radu 😊